SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
MultiDimComparator< T extends MultiDimComparable<? super T > Class Template Reference

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...

Inheritance diagram for MultiDimComparator< T extends MultiDimComparable<? super T >:
[legend]
Collaboration diagram for MultiDimComparator< T extends MultiDimComparable<? super T >:
[legend]

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...
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ MultiDimComparator()

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\}\).

Parameters
jindex used for comparison

Member Function Documentation

◆ compare()

int compare ( o1,
o2 
)

Calls o1.compareTo(o2, j) from class MultiDimComparable<T>.

Parameters
o1first object to compare
o2second object to compare

The documentation for this class was generated from the following file: