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 // set true if this node is driven from a paramter
19 private boolean isParameter;
21 public Set<FlowNode> getFieldNodeSet() {
25 private Set<FlowEdge> outEdgeSet;
27 public FlowNode(NTuple<Descriptor> tuple, boolean isParam) {
29 this.isParameter = isParam;
31 NTuple<Descriptor> base = null;
32 Descriptor desc = null;
33 if (tuple.size() > 1) {
34 base = tuple.subList(0, tuple.size() - 1);
35 desc = tuple.get(tuple.size() - 1);
39 fieldNodeSet = new HashSet<FlowNode>();
40 descTuple = new NTuple<Descriptor>();
42 descTuple.addAll(base);
47 outEdgeSet = new HashSet<FlowEdge>();
50 public void addFieldNode(FlowNode node) {
51 fieldNodeSet.add(node);
54 public boolean isParameter() {
58 public NTuple<Descriptor> getDescTuple() {
62 public Descriptor getOwnDescriptor() {
63 return descTuple.get(descTuple.size() - 1);
66 public String toString() {
67 String rtr = "[FlowNode]:";
71 rtr += ":" + descTuple;
75 public Iterator<FlowEdge> iteratorOfOutEdges() {
76 return outEdgeSet.iterator();
79 public void addOutEdge(FlowEdge out) {
83 public Set<FlowEdge> getOutEdgeSet() {
87 public int hashCode() {
88 return 7 + descTuple.hashCode();
91 public boolean equals(Object obj) {
93 if (obj instanceof FlowNode) {
94 FlowNode in = (FlowNode) obj;
95 if (descTuple.equals(in.getDescTuple())) {
104 public String getID() {
106 for (int i = 0; i < descTuple.size(); i++) {
107 id += descTuple.get(i).getSymbol();
112 public String getPrettyID() {
114 for (int i = 0; i < descTuple.size(); i++) {
118 id += descTuple.get(i).getSymbol();