gov.llnl.babel.backend

Class LevelComparator

Implemented Interfaces:
Comparator

public class LevelComparator
extends java.lang.Object
implements Comparator

Constructor Summary

LevelComparator(SymbolTable table)

Method Summary

int
compare(Object o1, Object o2)
Compare two SymbolIDs to see which type is more refined.
boolean
equals(Object obj)
The following equals method does not make sense for a sort comparator.

Constructor Details

LevelComparator

public LevelComparator(SymbolTable table)

Method Details

compare

public final int compare(Object o1,
                         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.
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(Object obj)
The following equals method does not make sense for a sort comparator. It always returns false.
Parameters:
obj - ignored
Returns:
false