umontreal.iro.lecuyer.util
Class MultiDimComparator<T extends MultiDimComparable<? super T>>
java.lang.Object
umontreal.iro.lecuyer.util.MultiDimComparator<T>
- All Implemented Interfaces:
- Comparator<T>
public class MultiDimComparator<T extends MultiDimComparable<? super T>>
- extends Object
- implements Comparator<T>
This class defines a bridge between our interface
MultiDimComparable and the classic
Comparator in Java. Precisely, this is
an implementation of Comparator, which compares
two MultiDimComparable objects in the dimension given in
the constructor. Method compare(o1, o2) simply calls
o1.compareTo(o2,i), where i is the index given
in the constructor.
|
Constructor Summary |
MultiDimComparator(int i)
Constructs a comparator, where i is the dimension
used in the comparisons. |
MultiDimComparator
public MultiDimComparator(int i)
- Constructs a comparator, where i is the dimension
used in the comparisons. Restrictions: 0 <= i < dimension of object.
- Parameters:
i - index used for comparison
compare
public int compare(T o1,
T o2)
- Calls o1.compareTo(o2, i) from class
MultiDimComparable.
- Specified by:
compare in interface Comparator<T extends MultiDimComparable<? super T>>
- Parameters:
o1 - first object to compareo2 - second object to compare
To submit a bug or ask questions, send an e-mail to
Pierre L'Ecuyer.