choco.palm.dbt.explain
Class BetterConstraintComparator

java.lang.Object
  extended by choco.palm.dbt.explain.BetterConstraintComparator
All Implemented Interfaces:
java.util.Comparator

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

Standard Constraint Comparator. For Instance, Collections.min(aCollection, new BetterConstraintComparator()); returns the constraint with the smaller weight, or if their weights are equal, the younger constraint (w.r.t. the constraint timestamp).


Constructor Summary
BetterConstraintComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares two PalmConstraint. o1 is less than o2 (returns a negative value) if and only if (o1.weight < o2.weight) or ( (o1.weight = o2.weight) and (o1.timestamp > o2.timestamp) ).
 
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

BetterConstraintComparator

public BetterConstraintComparator()
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compares two PalmConstraint. o1 is less than o2 (returns a negative value) if and only if (o1.weight < o2.weight) or ( (o1.weight = o2.weight) and (o1.timestamp > o2.timestamp) ).

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - First constraint.
o2 - Second constraint.
Returns:
A negative value if o1 < o2, a positive value if o1 > o2, 0 else.