Be more precise about enqueing dependent method contexts, and use topological sorted...
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / MethodContextQWrapper.java
diff --git a/Robust/src/Analysis/OwnershipAnalysis/MethodContextQWrapper.java b/Robust/src/Analysis/OwnershipAnalysis/MethodContextQWrapper.java
new file mode 100644 (file)
index 0000000..0e1fc1e
--- /dev/null
@@ -0,0 +1,50 @@
+package Analysis.OwnershipAnalysis;
+
+import IR.*;
+import IR.Flat.*;
+import java.util.*;
+import java.io.*;
+
+public class MethodContextQWrapper implements Comparable {
+
+  private int priority;
+  private MethodContext mc;
+
+  public MethodContextQWrapper( Integer p, MethodContext m ) {
+    priority = p.intValue();
+    mc = m;
+  }
+
+  public MethodContextQWrapper( int p, MethodContext m ) {
+    priority = p;
+    mc = m;
+  }
+
+  public MethodContext getMethodContext() {
+    return mc;
+  }
+  public int compareTo( Object o ) throws ClassCastException {
+
+    if( !(o instanceof MethodContextQWrapper) ) {
+      throw new ClassCastException();
+    }
+
+    MethodContextQWrapper mcqw = (MethodContextQWrapper) o;
+    return priority - mcqw.priority;
+  }
+
+  public boolean equals(Object o) {
+    if( o == null ) {
+      return false;
+    }
+
+    if( !( o instanceof MethodContextQWrapper) ) {
+      return false;
+    }
+    
+    MethodContextQWrapper mcqw = (MethodContextQWrapper) o;
+
+    return mc.equals( mcqw.mc );
+  }  
+}