static boolean canAdd(Structure structureDataType, int offset, int lengthToAdd,
			boolean isGrowthAllowed, TaskMonitor monitor) throws CancelledException {

		if (structureDataType.isPackingEnabled()) {
			throw new IllegalArgumentException(
				"Packed structures are not supported by this method");
		}

		DataTypeComponent component = structureDataType.getComponentContaining(offset);

		// structure not big enough to contain the offset 
		// if growStructure flag is true, return true so structure can be grown
		// if growStructure flag is false, return false since the offset does not exist so it would
		// be impossible to add anything at that offset
		if (component == null) {
			if (isGrowthAllowed) {
				return true;
			}
			return false;
		}

		// if growStructure flag is false and if offset + lengthToAdd is greater than length of 
		// structure then return false
		if (!isGrowthAllowed && (structureDataType.getLength() < (offset + lengthToAdd))) {
			return false;
		}

		// if the offset is in the middle of an internal component then return false 
		if (component.getOffset() != offset) {
			return false;
		}

		// no matter what size, if the data type at the offset is defined, return false
		// so it is not replaced
		if (component.getDataType() != DataType.DEFAULT) {
			return false;
		}

		if (lengthToAdd > 1) {
			DataTypeComponent nextDefinedComponent =
				structureDataType.getDefinedComponentAtOrAfterOffset(offset + 1);
			if (nextDefinedComponent == null) {
				return true;
			}
			int available = nextDefinedComponent.getOffset() - offset;
			return available >= lengthToAdd;
		}

		return true;
	}
Method to determine if the given structure has room at the given offset to have a component 
of the given length added to it. This is only valid for non-packed structures.
@param structureDataType the given structure
@param offset the offset to check for available room
@param lengthToAdd the length of bytes wanted to add at the offset
@param isGrowthAllowed Whether true or false, adding is only allowed if no collision will
happen with existing defined components. If true, allows structure to be grown beyond its end
if necessary. If false, it does not allow structure to be grown. 
@param monitor task monitor
@return true if the given structure has room at the given offset to have a component of the 
given length added to it or if the offset is beyond the end of the defined components in the
the structure so that the structure can be grown
@throws CancelledException if cancelled
@throws IllegalArgumentException if a packed structure is passed in
Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/EditStructureUtils.java