SSJ
V. labo.

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>

MultiDimComparator

This class defines a bridge between our interface MultiDimComparable and the classic java.utilComparator in Java. Precisely, this is an implementation of java.util.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)
          .
 
Method Summary
 int compare(T o1, T o2)
          .
 
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)
. \begin{tabb}
 Constructs a comparator, where \texttt{i} is the dimension
 used in the comparisons. Restrictions: $0 \le i < $\ dimension of object.
 \end{tabb}
iindex used for comparison

Method Detail

compare

public int compare(T o1,
                   T o2)
. \begin{tabb}
 Calls \texttt{o1.compareTo(o2, i)} from class
 \class{MultiDimComparable}.
 \end{tabb}
o1first object to compare o2second object to compare

Specified by:
compare in interface Comparator<T extends MultiDimComparable<? super T>>

SSJ
V. labo.

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