SSJ
V. 2.4.

umontreal.iro.lecuyer.util
Class MultiDimComparator<T extends MultiDimComparable<? super T>>

java.lang.Object
  extended by 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.
 
Method Summary
 int compare(T o1, T o2)
          Calls o1.compareTo(o2, i) from class MultiDimComparable.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

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
Method Detail

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 compare
o2 - second object to compare

SSJ
V. 2.4.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.