private AddressSetView trimAddressSet(Program program, AddressSetView view, Address address,
			boolean searchForward) {

		if (view == null || view.isEmpty()) {
			return view;
		}
		if (searchForward) {
			Address maxAddress = view.getMaxAddress();
			if (address.compareTo(maxAddress) > 0) {
				return new AddressSet();
			}
			return view.intersect(program.getAddressFactory().getAddressSet(address, maxAddress));
		}
		Address minAddress = view.getMinAddress();
		if (address.compareTo(minAddress) < 0) {
			return new AddressSet();
		}
		return view.intersect(program.getAddressFactory().getAddressSet(minAddress, address));
	}
Trims the given address set to only include addresses from the given address to the end of 
the address set if going forward or from the beginning of the address set to the given address
if going backwards. 
@param view the address set to trim
@param address the trim address
@param searchForward true if trimming from the beginning or false otherwise
@return a new address set with the potentially extraneous addresses removed.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/databasesearcher/ProgramDatabaseSearcher.java