public FieldRange subtract(FieldRange deleteRange) {
		if (!intersects(deleteRange)) {
			return null;
		}

		int compareStarts = start.compareTo(deleteRange.start);
		int compareEnds = end.compareTo(deleteRange.end);

		// check for case that splits this FieldRange
		if (compareStarts < 0 && compareEnds > 0) {
			FieldRange tailPiece = new FieldRange(deleteRange.end, end);
			// terminate this range with the delete range start
			end = deleteRange.start;
			return tailPiece;
		}
		// check for case the completely deletes me
		if (compareStarts >= 0 && compareEnds <= 0) {
			end = start;
			return null;
		}
		// case where my tail gets truncated
		if (compareStarts < 0) {
			end = deleteRange.start;
			return null;
		}
		// case where my front gets truncated
		start = deleteRange.end;
		return null;
	}
checks if the given location is contained in the range.
@param loc the field location.
@return true if the field range contains the specified location.
Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/support/FieldRange.java