Package jflex.core.unicode
Class IntCharSetComparator
- java.lang.Object
-
- jflex.core.unicode.IntCharSetComparator
-
- All Implemented Interfaces:
java.util.Comparator<IntCharSet>
public class IntCharSetComparator extends java.lang.Object implements java.util.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.
-
-
-
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 interfacejava.util.Comparator<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.
-
-