more changes
[IRC.git] / Robust / src / Analysis / Pointer / Graph.java
1 package Analysis.Pointer;
2 import java.util.*;
3 import Analysis.Disjoint.PointerMethod;
4 import Analysis.Pointer.AllocFactory.AllocNode;
5 import IR.Flat.*;
6
7 public class Graph {
8   /* This is field is set is this Graph is just a delta on the parent
9    * graph. */
10
11   Graph parent;
12   HashMap<AllocNode, MySet<Edge>> nodeMap;
13   HashMap<TempDescriptor, MySet<Edge>> varMap;
14   HashMap<AllocNode, MySet<Edge>> backMap;
15   MySet<Edge> strongUpdateSet;
16   MySet<Edge> reachEdge;
17   HashSet<AllocNode> reachNode;
18
19   /* Need this information for mapping in callee results */
20   HashSet<AllocNode> nodeAges;
21   HashMap<AllocNode, Boolean> oldNodes;
22
23   public Graph(Graph parent) {
24     nodeMap=new HashMap<AllocNode, MySet<Edge>>();
25     varMap=new HashMap<TempDescriptor, MySet<Edge>>();
26     nodeAges=new HashSet<AllocNode>();
27     oldNodes=new HashMap<AllocNode, Boolean>();
28     this.parent=parent;
29   }
30
31   public boolean containsNode(AllocNode node) {
32     return nodeAges.contains(node)||parent!=null&&parent.nodeAges.contains(node);
33   }
34
35   public MySet<Edge> getEdges(TempDescriptor tmp) {
36     if (varMap.containsKey(tmp))
37       return varMap.get(tmp);
38     else if (parent!=null&&parent.varMap.containsKey(tmp))
39       return parent.varMap.get(tmp);
40     else return emptySet;
41   }
42
43   public MySet<Edge> getEdges(AllocNode node) {
44     if (nodeMap.containsKey(node))
45       return nodeMap.get(node);
46     else if (parent!=null&&parent.nodeMap.containsKey(node))
47       return parent.nodeMap.get(node);
48     else return emptySet;
49   }
50
51   public static MySet<Edge> emptySet=new MySet<Edge>();
52 }