Search this API

y.layout.tree
Class XCoordComparator

java.lang.Object
  extended by y.layout.tree.XCoordComparator
All Implemented Interfaces:
java.util.Comparator, Comparators.PartialOrder

public class XCoordComparator
extends java.lang.Object
implements java.util.Comparator, Comparators.PartialOrder

This Comparator compares edges by examining the x-coordinates of the centers of their target nodes.

 

Constructor Summary
XCoordComparator()
          Creates a new XCoordComparator instance.
 
Method Summary
 int compare(java.lang.Object edge1, java.lang.Object edge2)
          Compares two edges by the x-coordinates of the centers of their target nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

XCoordComparator

public XCoordComparator()
Creates a new XCoordComparator instance.

Method Detail

compare

public int compare(java.lang.Object edge1,
                   java.lang.Object edge2)
Compares two edges by the x-coordinates of the centers of their target nodes.

Specified by:
compare in interface java.util.Comparator
Parameters:
edge1 - the first edge
edge2 - the second edge
Returns:
a negative value if the first target node is left of the second target node, a positive value if it's the other way round and 0 if both target nodes are at the same x-coordinate

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