Interface ElementComparator


public interface ElementComparator
An index-based comparator for a TokenSequence. An ElementComparator always exists in the context of a TokenSequence; indexes refer to this sequence.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A value indicating the left value was equal to the right value
    static final int
    A value indicating the left value was greater than the right value
    static final int
    A value indicating the left value was less than the right value
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareElements(int lhsIndex, int rhsIndex)
    Compares two sequence elements, specified by index.
  • Field Details

    • LESS_THAN

      static final int LESS_THAN
      A value indicating the left value was less than the right value
      See Also:
    • EQUALS

      static final int EQUALS
      A value indicating the left value was equal to the right value
      See Also:
    • GREATER_THAN

      static final int GREATER_THAN
      A value indicating the left value was greater than the right value
      See Also:
  • Method Details

    • compareElements

      int compareElements(int lhsIndex, int rhsIndex)
      Compares two sequence elements, specified by index.
      Parameters:
      lhsIndex - the index of the left hand element in the comparison
      rhsIndex - the index of the right hand element in the comparison
      Returns:
      0 if the values are equal, 1 if the left elements value is greater, -1 if the left elements value is lesser. A null value is greater than any other non-null; two null values compare as equal.