static KeySpan sub(long from, boolean fromInclusive, long to, boolean toInclusive,
			Direction direction) {
		if (from == to && (!fromInclusive || !toInclusive)) {
			return EMPTY;
		}
		return direction == Direction.FORWARD
				? DOMAIN.closed(fromInclusive ? from : from + 1, toInclusive ? to : to - 1)
				: DOMAIN.closed(toInclusive ? to : to + 1, fromInclusive ? from : from - 1);
	}
Get the span for a sub collection

<p>
{@code from} must precede {@code to}, unless direction is {@link Direction#BACKWARD}, in
which case the opposite is required. The endpoints may be equal but unless both are
inclusive, the result is {@link #EMPTY}. The two endpoints are not automatically inverted to
correct ordering. More often than not, accidental mis-ordering indicates an implementation
flaw.

@param from the lower bound
@param fromInclusive true if the bound includes {@code from}
@param to the upper bound
@param toInclusive true if the bound includes {@code to}
@param direction the direction, true to swap {@code from} and {@code to}
@return the span
Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/KeySpan.java