SSJ
3.3.1
Stochastic Simulation in Java
|
This class is useful if one wishes to perform an ordinary one-dimensional sort on MultiDimComparable<T> objects based on a single coordinate \(j\), which is specified in the constructor. More...
Public Member Functions | |
MultiDimComparator (int j) | |
Constructs a comparator that uses coordinate j for the comparison of MultiDimComparable<T> objects. More... | |
int | compare (T o1, T o2) |
Calls o1.compareTo(o2, j) from class MultiDimComparable<T>. More... | |
This class is useful if one wishes to perform an ordinary one-dimensional sort on MultiDimComparable<T> objects based on a single coordinate \(j\), which is specified in the constructor.
It defines a bridge between the MultiDimComparable<T> interface and the classic Comparator in Java. It implements Comparator in a way that the method compare(o1, o2)
compares two MultiDimComparable<T> objects in the dimension \(j\) given in the constructor, by calling o1.compareTo(o2, j)
.
MultiDimComparator | ( | int | j | ) |
Constructs a comparator that uses coordinate j
for the comparison of MultiDimComparable<T> objects.
One must have \(j \in\{0,…,d-1\}\).
j | index used for comparison |
int compare | ( | T | o1, |
T | o2 | ||
) |
Calls o1.compareTo(o2, j)
from class MultiDimComparable<T>.
o1 | first object to compare |
o2 | second object to compare |