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

    Fields
    Modifier and Type
    Field
    Description
    static 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 Type
    Method
    Description
    default 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).
    Returns a list of the keys that are associated with this span.
    int
    Returns the length of this span.
    int
    Returns the offset from the start of the text to the start of this span.
  • Field Details

    • OFFSET_COMPARATOR

      static final Comparator<ITextSpan> 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

      static final Comparator<ITextSpan> 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

      List<String> 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.