y.layout.tree
Class NodeOrderComparator
java.lang.Object
y.layout.tree.NodeOrderComparator
- All Implemented Interfaces:
- Comparator, Comparators.PartialOrder
public class NodeOrderComparator
- extends Object
- implements Comparator, Comparators.PartialOrder
This comparator compares edges by examining the Comparable
that is obtained by passing the target nodes
to
the get method
of the DataProvider
bound to the graph via the
NODE_ORDER_DPKEY
key.
- See Also:
TreeLayouter.setComparator(Comparator)
,
GenericTreeLayouter.setDefaultChildComparator(Comparator)
,
GenericTreeLayouter.CHILD_COMPARATOR_DPKEY
,
BalloonLayouter.setComparator(Comparator)
,
ARTreeLayouter.setComparator(Comparator)
,
HVTreeLayouter.setComparator(Comparator)
,
NODE_ORDER_DPKEY
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NODE_ORDER_DPKEY
public static final Object NODE_ORDER_DPKEY
- A data provider key that can be used to register a
DataProvider
for each Node
in the graph that yields a Comparable
object
via the DataProvider.get(Object)
method.
The values can be used by the various tree layouter implementations to sort the children
of each node in the tree and use the order to influence the layout.
To achieve this use this comparator and assign it to the layouter implementations
comparator property.
NodeOrderComparator
public NodeOrderComparator()
compare
public int compare(Object a,
Object b)
- Object is actually expected to be
Edge
.
Compares values returned by DataProvider.get(Object)
for
the target nodes
of the edges.
null
values or instances that do not implement the Comparable
interface will be treated as (equal) smaller values.
- Specified by:
compare
in interface Comparator