static boolean clearLengthAtOffset(Structure structure, int offset, int length,
			TaskMonitor monitor) throws CancelledException {

		if (structure.getLength() < offset + length) {
			return false;
		}

		List<Integer> offsetsToClear = new ArrayList<Integer>();

		int endOfClear = offset + length;

		while (offset < endOfClear) {

			monitor.checkCancelled();

			DataTypeComponent component = structure.getComponentContaining(offset);

			offsetsToClear.add(component.getOffset());
			offset = component.getOffset() + component.getLength();

		}

		if (offsetsToClear.isEmpty()) {
			return false;
		}

		Iterator<Integer> offsetIterator = offsetsToClear.iterator();
		while (offsetIterator.hasNext()) {
			Integer componentOffset = offsetIterator.next();
			// need to get ordinal from component using offset because after clearing 
			// component size > 1, the index changes
			DataTypeComponent component = structure.getComponentAt(componentOffset);
			int index = component.getOrdinal();
			structure.clearComponent(index);
		}
		return true;
	}
Method to check that all components starting with the one at the given offset and encompassing
all up to the given length from the given offset are an undefined data type. If so, clear them all and return true.
If not, do nothing and return false.
@param structure the given structure
@param offset the given offset in the structure
@param length the total length from the offset to hopefully clear
@param monitor task monitor
@return true if successfully cleared from offset to offset+length, false otherwise
@throws CancelledException if cancelled
Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/EditStructureUtils.java