more work towards new points to analysis
[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, HashSet<Edge>> nodeMap;
13   HashMap<TempDescriptor, HashSet<Edge>> varMap;
14   HashMap<AllocNode, HashSet<Edge>> backMap;
15   HashSet<Edge> strongUpdateSet;
16
17   public Graph(Graph parent) {
18     nodeMap=new HashMap<AllocNode, HashSet<Edge>>();
19     backMap=new HashMap<AllocNode, HashSet<Edge>>();
20     varMap=new HashMap<TempDescriptor, HashSet<Edge>>();
21     this.parent=parent;
22   }
23
24   public HashSet<Edge> getEdges(TempDescriptor tmp) {
25     if (varMap.containsKey(tmp))
26       return varMap.get(tmp);
27     else if (parent!=null&&parent.varMap.containsKey(tmp))
28       return parent.varMap.get(tmp);
29     else return emptySet;
30   }
31
32   public HashSet<Edge> getEdges(AllocNode node) {
33     if (nodeMap.containsKey(node))
34       return nodeMap.get(node);
35     else if (parent!=null&&parent.nodeMap.containsKey(node))
36       return parent.nodeMap.get(node);
37     else return emptySet;
38   }
39
40   public static HashSet<Edge> emptySet=new HashSet<Edge>();
41 }