Package jflex.core.unicode
Class IntCharSetComparator
- java.lang.Object
-
- jflex.core.unicode.IntCharSetComparator
-
- All Implemented Interfaces:
Comparator<IntCharSet>
public class IntCharSetComparator extends Object implements Comparator<IntCharSet>
Comparator ofIntCharSet
.
-
-
Constructor Summary
Constructors Constructor Description IntCharSetComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(IntCharSet left, IntCharSet right)
Compares two IntCharSets.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
compare
public int compare(IntCharSet left, IntCharSet right)
Compares two IntCharSets.Assumption: the IntCharSets are disjoint, e.g. members of a partition.
This method does not implement subset order, but instead compares the smallest elements of the two sets, with the empty set smaller than any other set. This is to make the order total for partitions as in
CharClasses
. It is unlikely to otherwise be a useful order, and it does probably not implement the contract forComparable.compareTo(T)
correctly if the sets have the same smallest element but are not equal.- Specified by:
compare
in interfaceComparator<IntCharSet>
- Returns:
- 0 if the parameter is equal, -1 if its smallest element (if any) is larger than the smallest element of this set, and +1 if it is larger.
-
-