Package uk.blankaspect.common.text
Interface ITextSpan
- All Known Implementing Classes:
JsonText.Span
public interface ITextSpan
This interface defines the methods that must be implemented by a class that represents a span of text (that is, a
sequence of characters).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator
<ITextSpan> A comparator that compares two spans by the offset from the start of the text to the start of the span.static final Comparator
<ITextSpan> A comparator that compares two spans: first, by the offset from the start of the text to the start of the span; then, if the offsets are equal, by the length of the span. -
Method Summary
Modifier and TypeMethodDescriptiondefault int
Returns the offset from the start of the text to the exclusive end of this span (that is, the character immediately after the end of this span).keys()
Returns a list of the keys that are associated with this span.int
length()
Returns the length of this span.int
offset()
Returns the offset from the start of the text to the start of this span.
-
Field Details
-
OFFSET_COMPARATOR
A comparator that compares two spans by the offset from the start of the text to the start of the span. -
OFFSET_LENGTH_COMPARATOR
A comparator that compares two spans: first, by the offset from the start of the text to the start of the span; then, if the offsets are equal, by the length of the span.
-
-
Method Details
-
offset
int offset()Returns the offset from the start of the text to the start of this span.- Returns:
- the offset from the start of the text to the start of this span.
-
endOffset
default int endOffset()Returns the offset from the start of the text to the exclusive end of this span (that is, the character immediately after the end of this span).- Returns:
- the offset from the start of the text to the exclusive end of this span.
-
length
int length()Returns the length of this span.- Returns:
- the length of this span.
-
keys
Returns a list of the keys that are associated with this span.- Returns:
- a list of the keys that are associated with this span.
-