umontreal.iro.lecuyer.util
Class DoubleArrayComparator
java.lang.Object
umontreal.iro.lecuyer.util.DoubleArrayComparator
- All Implemented Interfaces:
- Comparator<double[]>
public class DoubleArrayComparator
- extends Object
- implements Comparator<double[]>
An implementation of Comparator
which compares two
double arrays by comparing their i-th element,
where i is given in the constructor.
Method compare(d1, d2) returns -1, 0, or 1 depending on
whether d1[i] is less than, equal to, or greater than
d2[i].
Constructor Summary |
DoubleArrayComparator(int i)
Constructs a comparator, where i is the index
used for the comparisons. |
Method Summary |
int |
compare(double[] d1,
double[] d2)
Returns -1, 0, or 1 depending on
whether d1[i] is less than, equal
to, or greater than d2[i]. |
DoubleArrayComparator
public DoubleArrayComparator(int i)
- Constructs a comparator, where i is the index
used for the comparisons.
- Parameters:
i
- index used for comparison
compare
public int compare(double[] d1,
double[] d2)
- Returns -1, 0, or 1 depending on
whether d1[i] is less than, equal
to, or greater than d2[i].
- Specified by:
compare
in interface Comparator<double[]>
- Parameters:
d1
- first arrayd2
- second array
To submit a bug or ask questions, send an e-mail to
Pierre L'Ecuyer.