public final class Comparators extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(double d1,
double d2)
Compares the specified floating point numbers.
|
static Comparator<Object> |
createComparableComparator()
Returns a
Comparator that compares to Objects of type Comparable. |
static Comparator<Object> |
createComparableDataComparator(IDataProvider dp)
Returns a
Comparator that compares objects of arbitrary type. |
static Comparator<Object> |
createDoubleDataComparator(IDataProvider dp)
Returns a
Comparator that compares objects of arbitrary type. |
static Comparator<Object> |
createDoubleDataSourceComparator(IDataProvider dp)
Returns a
Comparator that compares objects of type Edge. |
static Comparator<Object> |
createDoubleDataTargetComparator(IDataProvider dp)
Returns a
Comparator that compares objects of type Edge. |
static Comparator<Object> |
createIntDataComparator(IDataProvider dp)
Returns a
Comparator that compares objects of arbitrary type. |
static Comparator<Object> |
createIntDataSourceComparator(IDataProvider dp)
Returns a
Comparator that compares objects of type Edge. |
static Comparator<Object> |
createIntDataTargetComparator(IDataProvider dp)
Returns a
Comparator that compares objects of type Edge. |
public static final int compare(double d1,
double d2)
Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
Warning: This method does not handle NaN! If you need NaN-safe comparison, use Double.compare(double, double)
instead.
d1 - the first number to compare.d2 - the second number to compare.Comparator.compare(Object, Object)public static final Comparator<Object> createComparableComparator()
Comparator that compares to Objects of type Comparable.public static final Comparator<Object> createComparableDataComparator(IDataProvider dp)
Comparator that compares objects of arbitrary type.
Two objects are compared by comparing the Comparable instances the given data provider returns for each of these
objects.
dp - a data provider that must return a Comparable for each object that is being compared by this comparator.Comparator that compares arbitrary objects.public static final Comparator<Object> createDoubleDataComparator(IDataProvider dp)
Comparator that compares objects of arbitrary type.
Two objects are compared by comparing the double value the given data provider returns for each of these objects.
dp - a data provider that must return a double value for each object that is being compared by this comparator.Comparator that compares arbitrary objects.public static final Comparator<Object> createDoubleDataSourceComparator(IDataProvider dp)
Comparator that compares objects of type Edge.
Two edges are compared by comparing their source nodes. Each source node e.source() in turn is compared by the
double value provided by the given data provider: dp.getDouble(e.source()).
dp - a data provider that must return a double value for the source node of each edge being compared.Comparator that compares edges.public static final Comparator<Object> createDoubleDataTargetComparator(IDataProvider dp)
Comparator that compares objects of type Edge.
Two edges are compared by comparing their target nodes. Each target node e.target() in turn is compared by the
double value provided by the given data provider: dp.getDouble(e.target()).
dp - a data provider that must return a double value for the target node of each edge being compared.Comparator that compares edges.public static final Comparator<Object> createIntDataComparator(IDataProvider dp)
Comparator that compares objects of arbitrary type.
Two objects are compared by comparing the int value the given data provider returns for each of these objects.
dp - a data provider that must return an int value for each object that is being compared by this comparator.Comparator that compares arbitrary objects.public static final Comparator<Object> createIntDataSourceComparator(IDataProvider dp)
Comparator that compares objects of type Edge.
Two edges are compared by comparing their source nodes. Each source node e.source() in turn is compared by the
int value provided by the given data provider: dp.getInt(e.source()).
dp - a data provider that must return an int value for the source node of each edge being compared.Comparator that compares edges.public static final Comparator<Object> createIntDataTargetComparator(IDataProvider dp)
Comparator that compares objects of type Edge.
Two edges are compared by comparing their target nodes. Each target node e.target() in turn is compared by the
int value provided by the given data provider: dp.getInt(e.target()).
dp - a data provider that must return an int value for the target node of each edge being compared.Comparator that compares edges.