superpeer
Class CapacityComparator

java.lang.Object
  extended by superpeer.CapacityComparator
All Implemented Interfaces:
java.util.Comparator

public class CapacityComparator
extends java.lang.Object
implements java.util.Comparator


Constructor Summary
CapacityComparator(int direction)
          Initializes the direction of this comparator.
CapacityComparator(int direction, int pid)
          Initializes the direction of this comparator.
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
           
 
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

CapacityComparator

public CapacityComparator(int direction)
Initializes the direction of this comparator. If direction is 1, an array sorted with this comparator is sorted in increasing order of capacity. If direction is -1, the array is sorted in decreasing order.


CapacityComparator

public CapacityComparator(int direction,
                          int pid)
Initializes the direction of this comparator. If direction is 1, an array sorted with this comparator is sorted in increasing order of capacity. If direction is -1, the array is sorted in decreasing order.

Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Specified by:
compare in interface java.util.Comparator