Interface FieldSpan
- All Superinterfaces:
Comparable<FieldSpan>,End.EndSpan<Field,,FieldSpan> Span<End<Field>,FieldSpan>
- All Known Implementing Classes:
FieldSpan.Empty,FieldSpan.Impl
We must allow open endpoints here. Consider a string field. There is no well-defined increment or
decrement on strings. Let them be ordered lexicographically. What string immediately
precedes "Span"? It is not "Spam", since "Spammer" falls between. In
fact, for any string having the prefix "Spam", you can add another character to it to
find a string after it, but still preceding "Span". Thus, we use End.EndSpan, so that
End("Span" - epsilon) can stand in for the value immediately preceding "Span".
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThe domain of field values, allowing open endpointsstatic final classThe singleton empty span of field valuesstatic final recordA span of field valuesNested classes/interfaces inherited from interface generic.Span
Span.DefaultSpanMap<N,S extends Span<N, S>, V>, Span.DefaultSpanSet<N, S extends Span<N, S>>, Span.MutableSpanMap<N, S extends Span<N, S>, V>, Span.MutableSpanSet<N, S extends Span<N, S>>, Span.SpanMap<N, S extends Span<N, S>, V>, Span.SpanMapSetter<E, N, S extends Span<N, S>, V>, Span.SpanSet<N, S extends Span<N, S>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FieldSpan.Implstatic final FieldSpan.Domainstatic final FieldSpan.Empty -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic FieldSpanhead(Field to, boolean toInclusive, DirectedIterator.Direction direction) Get the span for the head of a collectionstatic FieldSpansub(Field from, boolean fromInclusive, Field to, boolean toInclusive, DirectedIterator.Direction direction) Get the span for a sub collectionstatic FieldSpantail(Field from, boolean fromInclusive, DirectedIterator.Direction direction) Get the span for the tail of a collectionMethods inherited from interface generic.End.EndSpan
containsPointMethods inherited from interface generic.Span
bound, compareTo, contains, domain, encloses, intersect, intersects, isEmpty, max, maxIsFinite, min, minIsFinite, subtract, toString
-
Field Details
-
DOMAIN
-
EMPTY
-
ALL
-
-
Method Details
-
sub
static FieldSpan sub(Field from, boolean fromInclusive, Field to, boolean toInclusive, DirectedIterator.Direction direction) Get the span for a sub collectionfrommust precedeto, unless direction isDirectedIterator.Direction.BACKWARD, in which case the opposite is required. The endpoints may be equal but unless both are inclusive, the result isEMPTY. The two endpoints are not automatically inverted to correct ordering. More often than not, accidental mis-ordering indicates an implementation flaw.- Parameters:
from- the lower boundfromInclusive- true if the bound includesfromto- the upper boundtoInclusive- true if the bound includestodirection- the direction, true to swapfromandto- Returns:
- the span
-
head
Get the span for the head of a collectionWhen
directionisDirectedIterator.Direction.BACKWARDthis behaves as if a tail collection; however, the implication is that iteration will start from the maximum and proceed toward the given bound.- Parameters:
to- the upper boundtoInclusive- true if the bound includestodirection- the direction, true to create a tail instead- Returns:
- the span
-
tail
Get the span for the tail of a collectionWhen
directionisDirectedIterator.Direction.BACKWARDthis behaves as if a head collection; however, the implication is that iteration will start from the bound and proceed toward the minimum.- Parameters:
from- the lower boundfromInclusive- true if the bound includestodirection- the direction, true to create a head instead- Returns:
- the span
-