y.util
Class Comparators

java.lang.Object
  |
  +--y.util.Comparators

public class Comparators
extends Object

This class provides access to some Comparator instances that are commenly used in yFiles.


Constructor Summary
Comparators()
           
 
Method Summary
static Comparator createComparableComparator()
          Returns a comparator that compares to Objects of type Comparable.
static Comparator createDoubleDataComparator(DataProvider dp)
          Returns a comparator that compares objects of arbitrary type.
static Comparator createDoubleDataSourceComparator(DataProvider dp)
          Returns a comparator that compares objects of type Edge.
static Comparator createDoubleDataTargetComparator(DataProvider dp)
          Returns a comparator that compares objects of type Edge.
static Comparator createIntDataComparator(DataProvider dp)
          Returns a comparator that compares objects of arbitrary type.
static Comparator createIntDataSourceComparator(DataProvider dp)
          Returns a comparator that compares objects of type Edge.
static Comparator createIntDataTargetComparator(DataProvider dp)
          Returns a comparator that compares objects of type Edge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Comparators

public Comparators()
Method Detail

createIntDataSourceComparator

public static Comparator createIntDataSourceComparator(DataProvider dp)
Returns a 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()).

Parameters:
dp - a dataprovider that must return an int value for the source node of each edge being compared.
Returns:
a comparator that compares edges.

createIntDataTargetComparator

public static Comparator createIntDataTargetComparator(DataProvider dp)
Returns a 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()).

Parameters:
dp - a dataprovider that must return an int value for the target node of each edge being compared.
Returns:
a comparator that compares edges.

createDoubleDataSourceComparator

public static Comparator createDoubleDataSourceComparator(DataProvider dp)
Returns a 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()).

Parameters:
dp - a dataprovider that must return a double value for the source node of each edge being compared.
Returns:
a comparator that compares edges.

createDoubleDataTargetComparator

public static Comparator createDoubleDataTargetComparator(DataProvider dp)
Returns a 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()).

Parameters:
dp - a dataprovider that must return a double value for the target node of each edge being compared.
Returns:
a comparator that compares edges.

createIntDataComparator

public static Comparator createIntDataComparator(DataProvider dp)
Returns a 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.

Parameters:
dp - a dataprovider that must return an int value for each object that is being compared by this comparator.
Returns:
a comparator that compares arbitrary objects.

createDoubleDataComparator

public static Comparator createDoubleDataComparator(DataProvider dp)
Returns a 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.

Parameters:
dp - a dataprovider that must return a double value for each object that is being compared by this comparator.
Returns:
a comparator that compares arbitrary objects.

createComparableComparator

public static Comparator createComparableComparator()
Returns a comparator that compares to Objects of type Comparable.


© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003