ix.util
Class ObjectComparator
java.lang.Object
ix.util.ObjectComparator
- All Implemented Interfaces:
- java.util.Comparator
- Direct Known Subclasses:
- KeyValueTable.LexicographicComparator, KeyValueTable.PatternObjectComparator
public class ObjectComparator
- extends java.lang.Object
- implements java.util.Comparator
Provides a total ordering for arbitrary objects.
It should be consistent with equals.
Method Summary |
int |
compare(java.lang.Object a,
java.lang.Object b)
Returns an int < 0, == 0, or > 0 depending on whether the
first object is less than, equal to, or greater than the second. |
protected int |
compareComparable(java.lang.Comparable a,
java.lang.Comparable b)
|
protected int |
compareLists(java.util.List a,
java.util.List b)
|
protected int |
compareNumbers(java.lang.Number a,
java.lang.Number b)
|
protected int |
compareSymbol(java.lang.Object a,
java.lang.Object b)
|
protected int |
defaultCompare(java.lang.Object a,
java.lang.Object b)
|
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 |
ObjectComparator
public ObjectComparator()
compare
public int compare(java.lang.Object a,
java.lang.Object b)
- Returns an int < 0, == 0, or > 0 depending on whether the
first object is less than, equal to, or greater than the second.
- Specified by:
compare
in interface java.util.Comparator
- Throws:
java.lang.ClassCastException
- if the objects cannot be compared.
compareSymbol
protected int compareSymbol(java.lang.Object a,
java.lang.Object b)
compareNumbers
protected int compareNumbers(java.lang.Number a,
java.lang.Number b)
compareLists
protected int compareLists(java.util.List a,
java.util.List b)
compareComparable
protected int compareComparable(java.lang.Comparable a,
java.lang.Comparable b)
defaultCompare
protected int defaultCompare(java.lang.Object a,
java.lang.Object b)