net.i2p.router.peermanager
Class InverseCapacityComparator

java.lang.Object
  extended by net.i2p.router.peermanager.InverseCapacityComparator
All Implemented Interfaces:
java.util.Comparator

 class InverseCapacityComparator
extends java.lang.Object
implements java.util.Comparator

Order profiles by their capacity, but backwards (highest capacity / value first).


Constructor Summary
InverseCapacityComparator()
           
 
Method Summary
 int compare(java.lang.Object lhs, java.lang.Object rhs)
          Compare the two objects backwards.
 
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

InverseCapacityComparator

InverseCapacityComparator()
Method Detail

compare

public int compare(java.lang.Object lhs,
                   java.lang.Object rhs)
Compare the two objects backwards. The standard comparator returns -1 if lhs is less than rhs, 1 if lhs is greater than rhs, or 0 if they're equal. To keep a strict ordering, we measure peers with equal capacity values according to their speed

Specified by:
compare in interface java.util.Comparator
Returns:
-1 if the right hand side is smaller, 1 if the left hand side is smaller, or 0 if they are the same peer (Comparator.compare() inverted)