Package com.gengoai.collection.tree
Interface Span
-
- All Superinterfaces:
Comparable<Span>
,Serializable
- All Known Implementing Classes:
SimpleSpan
public interface Span extends Serializable, Comparable<Span>
A Span represents a continuous segment with a start and end.
- Author:
- David B. Bracewell
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
compareTo(Span o)
default boolean
encloses(Span other)
Returns true if the bounds of the other text do not extend outside the bounds of this text.int
end()
The ending offsetdefault boolean
isEmpty()
Checks if the span is empty (start == end
)int
length()
The length of the spanstatic Span
of(int start, int end)
Of span.default boolean
overlaps(Span other)
Returns true if the bounds of other text are connected with the bounds of this text.int
start()
The starting offset
-
-
-
Method Detail
-
of
static Span of(int start, int end)
Of span.- Parameters:
start
- the startend
- the end- Returns:
- the span
-
compareTo
default int compareTo(Span o)
- Specified by:
compareTo
in interfaceComparable<Span>
-
encloses
default boolean encloses(Span other)
Returns true if the bounds of the other text do not extend outside the bounds of this text.- Parameters:
other
- The other text to check if this one encloses- Returns:
- True if the two texts are in the same document and this text encloses the other, False otherwise
-
end
int end()
The ending offset- Returns:
- The ending offset (exclusive).
-
isEmpty
default boolean isEmpty()
Checks if the span is empty (start == end
)- Returns:
- True if the span is empty, False if not
-
length
int length()
The length of the span- Returns:
- The length of the span
-
overlaps
default boolean overlaps(Span other)
Returns true if the bounds of other text are connected with the bounds of this text.- Parameters:
other
- The other text to check if this one overlaps- Returns:
- True if the two texts are in the same document and overlap, False otherwise
-
start
int start()
The starting offset- Returns:
- The start offset (inclusive).
-
-