java.lang.Object
com.port80.graph.dot.impl.DotVertex.RankComparator
- All Implemented Interfaces:
- java.util.Comparator
- Enclosing class:
- DotVertex
- public static class DotVertex.RankComparator
- extends java.lang.Object
- implements java.util.Comparator
Compare DotVertex by its rank (lowest rank highest priority).
Note that this comparator reversed the sense of the compare() output
so that priority heap should dequeue lowest rank first (as highest priority).
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DotVertex.RankComparator
public DotVertex.RankComparator()
compare
public int compare(java.lang.Object a,
java.lang.Object b)
- Description copied from interface:
java.util.Comparator
- Return an integer that is negative, zero or positive depending on whether
the first argument is less than, equal to or greater than the second
according to this ordering. This method should obey the following
contract:
- if compare(a, b) < 0 then compare(b, a) > 0
- if compare(a, b) throws an exception, so does compare(b, a)
- if compare(a, b) < 0 and compare(b, c) < 0 then compare(a, c)
< 0
- if compare(a, b) == 0 then compare(a, c) and compare(b, c) must
have the same sign
To be consistent with equals, the following additional constraint is
in place:
- if a.equals(b) or both a and b are null, then
compare(a, b) == 0.
Although it is permissible for a comparator to provide an order
inconsistent with equals, that should be documented.
- Specified by:
compare in interface java.util.Comparator
equals
public boolean equals(java.lang.Object a,
java.lang.Object b)