public class NodeOrderComparator extends Object implements Comparator<Object>, com.yworks.yfiles.algorithms.Comparators.IPartialOrder
NodeOrderComparator compares edges according to a specified order.
It obtains the order from a IDataProvider registered with the graph with key
NODE_ORDER_COMPARABLE_DPKEY.
Various tree layout algorithms can use this Comparator to influence the resulting layout. To achieve this, use
this comparator and assign it to the comparator property of the layout algorithm classes.
| Modifier and Type | Field and Description |
|---|---|
static NodeDpKey<Comparable> |
NODE_ORDER_COMPARABLE_DPKEY
A
DataProvider key for registering an order for each node in the graph
|
| Constructor and Description |
|---|
NodeOrderComparator()
Creates a new
NodeOrderComparator instance. |
| Modifier and Type | Method and Description |
|---|---|
int |
compare(Object edge1,
Object edge2)
Compares two edges according to their index in the order specified using a
IDataProvider. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic static final NodeDpKey<Comparable> NODE_ORDER_COMPARABLE_DPKEY
DataProvider key for registering an order for each node in the graph
public NodeOrderComparator()
NodeOrderComparator instance.public int compare(Object edge1, Object edge2)
IDataProvider.
Target nodes for which the IDataProvider registered with NODE_ORDER_COMPARABLE_DPKEY returns null
or an Object that does not implement Comparable are treated as being smaller than other target nodes.
compare in interface Comparator<Object>edge1 - the first edgeedge2 - the second edgeNODE_ORDER_COMPARABLE_DPKEY