void doReplaceWith(StructureInternal struct, boolean notify)
			throws DataTypeDependencyException, IOException {

		int oldAlignment = getAlignment();
		int oldLength = structLength;

		// pre-resolved component types to catch dependency issues early
		DataTypeComponent[] otherComponents = struct.getDefinedComponents();
		DataType[] resolvedDts = new DataType[otherComponents.length];
		for (int i = 0; i < otherComponents.length; i++) {
			resolvedDts[i] = doCheckedResolve(otherComponents[i].getDataType());
		}
		for (DataTypeComponentDB dtc : components) {
			dtc.getDataType().removeParent(this);
			long compKey = dtc.getKey();
			componentAdapter.removeRecord(compKey);
			dataMgr.getSettingsAdapter().removeAllSettingsRecords(compKey);
		}

		components.clear();
		numComponents = 0;
		structLength = 0;
		structAlignment = -1;
		computedAlignment = -1;

		doSetPackingAndAlignment(struct);

		if (struct.getDataTypeManager() == dataMgr) {
			// assume layout is good and can just be copied without packing
			// NOTE: this optimization has been added to StructureDB only
			doCopy(struct, otherComponents, resolvedDts);
		}
		else {
			if (struct.isPackingEnabled()) {
				doReplaceWithPacked(struct, resolvedDts);
			}
			else {
				doReplaceWithNonPacked(struct, resolvedDts);
			}
			repack(false, false);
		}

		// must force record update
		record.setIntValue(CompositeDBAdapter.COMPOSITE_NUM_COMPONENTS_COL, numComponents);
		record.setIntValue(CompositeDBAdapter.COMPOSITE_LENGTH_COL, structLength);
		record.setIntValue(CompositeDBAdapter.COMPOSITE_ALIGNMENT_COL, structAlignment);
		record.setString(CompositeDBAdapter.COMPOSITE_COMMENT_COL, struct.getDescription());
		compositeAdapter.updateRecord(record, true); // updates timestamp

		if (notify) {
			if (structLength != oldLength) {
				notifySizeChanged(false);
			}
			else if (structAlignment != oldAlignment) {
				notifyAlignmentChanged(false);
			}
			else {
				dataMgr.dataTypeChanged(this, false);
			}
		}

		if (pointerPostResolveRequired) {
			dataMgr.queuePostResolve(this, struct);
		}
	}
Replaces the internal components of this structure with components of the given structure
including packing and alignment settings.

@param struct structure to be copied
@param notify provide notification if true
@throws DataTypeDependencyException if circular dependency detected
@throws IOException if database IO error occurs
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/StructureDB.java