gov.llnl.babel.backend
Class LevelComparator

java.lang.Object
  extended by gov.llnl.babel.backend.LevelComparator
All Implemented Interfaces:
java.util.Comparator

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


Constructor Summary
LevelComparator(SymbolTable table)
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare two SymbolIDs to see which type is more refined.
 boolean equals(java.lang.Object obj)
          The following equals method does not make sense for a sort comparator.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LevelComparator

public LevelComparator(SymbolTable table)
Method Detail

compare

public final int compare(java.lang.Object o1,
                         java.lang.Object o2)
Compare two SymbolIDs to see which type is more refined. An object is considered lesser if there are more types in the type hierarchy between it and the base exception type than the object it is being compared with.

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - this should be a SymbolID object.
o2 - this should be a SymbolID object.
Returns:
-1 if o1 has more types in the type hierarchy between it and the base exception type than o2. 1 if o1 has fewer types in the type hierarchy between it and the base exception type than o2. Otherwise, 0 is returned.

equals

public final boolean equals(java.lang.Object obj)
The following equals method does not make sense for a sort comparator. It always returns false.

Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object
Parameters:
obj - ignored
Returns:
false