Class OffsetRange

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    MatchHighlighter.QueryOffsetRange, Passage

    public class OffsetRange
    extends java.lang.Object
    implements java.lang.Cloneable
    A non-empty range of offset positions.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int from
      Start index, inclusive.
      int to
      End index, exclusive.
    • Constructor Summary

      Constructors 
      Constructor Description
      OffsetRange​(int from, int to)  
    • Field Detail

      • from

        public final int from
        Start index, inclusive.
      • to

        public final int to
        End index, exclusive.
    • Constructor Detail

      • OffsetRange

        public OffsetRange​(int from,
                           int to)
        Parameters:
        from - Start index, inclusive.
        to - End index, exclusive.
    • Method Detail

      • length

        public int length()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • slice

        public OffsetRange slice​(int from,
                                 int to)
        Returns a sub-range of this range (a copy). Subclasses should override and return an appropriate type covariant so that payloads are not lost.
      • contains

        public boolean contains​(OffsetRange other)
        Returns:
        true if this range contains or is equal to other.
      • clone

        public OffsetRange clone()
        Overrides:
        clone in class java.lang.Object