1 package Analysis.TaskStateAnalysis;
2 import java.util.Hashtable;
3 import java.util.Comparator;
4 import java.util.Iterator;
5 import IR.FlagDescriptor;
7 /**Note: this comparator imposes orderings that are inconsistent with equals.*/
9 public class FlagComparator implements Comparator {
11 public FlagComparator(Hashtable flaginfo) {
12 this.flaginfo=flaginfo;
15 public int compare(Object o1, Object o2) {
16 int fs1=getFlagInt((FlagState)o1);
17 int fs2=getFlagInt((FlagState)o2);
21 public int getFlagInt(FlagState fs) {
23 for(Iterator flags = fs.getFlags(); flags.hasNext(); ) {
24 FlagDescriptor flagd = (FlagDescriptor)flags.next();
25 int id=1<<((Integer)flaginfo.get(flagd)).intValue();