1 package Analysis.SSJava;
3 import java.util.HashSet;
4 import java.util.Iterator;
9 public class FlowNode {
11 // descriptor tuple is a unique identifier of the flow node
12 private NTuple<Descriptor> descTuple;
14 // if the infer node represents the base type of field access,
15 // this set contains fields of the base type
16 private Set<FlowNode> fieldNodeSet;
18 public Set<FlowNode> getFieldNodeSet() {
22 private Set<FlowEdge> outEdgeSet;
24 public FlowNode(NTuple<Descriptor> tuple) {
26 NTuple<Descriptor> base = null;
27 Descriptor desc = null;
28 if (tuple.size() > 1) {
29 base = tuple.subList(0, tuple.size() - 1);
30 desc = tuple.get(tuple.size() - 1);
34 fieldNodeSet = new HashSet<FlowNode>();
35 descTuple = new NTuple<Descriptor>();
37 descTuple.addAll(base);
42 outEdgeSet = new HashSet<FlowEdge>();
45 public void addFieldNode(FlowNode node) {
46 fieldNodeSet.add(node);
49 public NTuple<Descriptor> getDescTuple() {
53 public Descriptor getOwnDescriptor() {
54 return descTuple.get(descTuple.size() - 1);
57 public String toString() {
58 return "[FlowNode]::" + descTuple;
61 public Iterator<FlowEdge> iteratorOfOutEdges() {
62 return outEdgeSet.iterator();
65 public void addOutEdge(FlowEdge out) {
69 public Set<FlowEdge> getOutEdgeSet() {
73 public int hashCode() {
74 return 7 + descTuple.hashCode();
77 public boolean equals(Object obj) {
79 if (obj instanceof FlowNode) {
80 FlowNode in = (FlowNode) obj;
81 if (descTuple.equals(in.getDescTuple())) {
90 public String getID() {
92 for (int i = 0; i < descTuple.size(); i++) {
93 id += descTuple.get(i).getSymbol();