planet.symphony
Class IdComparer
java.lang.Object
planet.symphony.IdComparer
- All Implemented Interfaces:
- java.io.Serializable, java.util.Comparator, Comparer
public class IdComparer
- extends java.lang.Object
- implements Comparer, java.util.Comparator, java.io.Serializable
This is class is used to compare two ids. For that purpose, it implements interface Comparer.
This includes a method called compare which returns a negative integer, zero, or a
positive integer as the first argument is less than, equal to, or greater than the second.
- Author:
- Marc Sanchez, Jordi Pujol
- See Also:
- Serialized Form
Method Summary |
int |
compare(java.lang.Object o1,
java.lang.Object o2)
A comparison function, which imposes a total ordering on some collection of objects. |
boolean |
equals(java.lang.Object o)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IdComparer
public IdComparer(NodeHandle root)
compare
public int compare(java.lang.Object o1,
java.lang.Object o2)
- Description copied from interface:
Comparer
- A comparison function, which imposes a total ordering on some collection of objects. Comparer
can be passed to a sort method to allow precise control over the sort order. Comparer can also
be used to control the order of certain data structures. The ordering imposed by a Comparer c
on a set of elements S is said to be consistent with equals if and only if (compare((Object)e1,
(Object)e2)==0) has the same boolean value as e1.equals((Object)e2) for every e1 and e2 in S.
- Specified by:
compare
in interface java.util.Comparator
- Specified by:
compare
in interface Comparer
- Parameters:
o1
- The first object to be compared.o2
- The second object to be compared.
- Returns:
- A negative integer, zero, or a positive integer as the first argument is less than,
equal to, or greater than the second.
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interface java.util.Comparator
- Overrides:
equals
in class java.lang.Object