private AddressValueRange<T> adjustPreviousRangeForOverlap(Address start, Address end,
			T object, AddressValueRange<T> newRange, int pos) {

		AddressValueRange<T> previousRange = ranges.get(pos);
		if ((start.previous() == null) ||
			(previousRange.getEnd().compareTo(start.previous()) < 0)) {
			return newRange;  // no overlap
		}

		Address oldStart = previousRange.getStart();
		Address oldEnd = previousRange.getEnd();
		T oldValue = previousRange.getValue();

		if (valuesEqual(previousRange.getValue(), object)) {  // same objects, merge
			ranges.remove(pos);
			newRange = new AddressValueRange<T>(oldStart, getMax(oldEnd, end), object);
		}
		// break previous record into sub-ranges that exclude the new range
		else {
			ranges.set(pos, new AddressValueRange<T>(oldStart, start.previous(), oldValue));

			// previous range extends past the new range
			if (previousRange.getEnd().compareTo(end) > 0) {
				ranges.add(pos + 1, new AddressValueRange<T>(end.next(), oldEnd, oldValue));
			}
		}

		return newRange;
	}
Associates the given object with all indices in the given range. The object may be null,
but an association is still established.  Use the clearRange() method to remove associations.
@param start the start of the range.
@param end the end (inclusive) of the range.
@param object the object to associate with the given range.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/register/AddressRangeObjectMap.java