changes.
[IRC.git] / Robust / src / Analysis / SSJava / FlowNode.java
index 86edb08d6c463b158ab56114acda1af13e9703f8..7ce39ed50055c8c9b4be6140ee22259a3d83ff88 100644 (file)
@@ -5,6 +5,8 @@ import java.util.Iterator;
 import java.util.Set;
 
 import IR.Descriptor;
+import IR.FieldDescriptor;
+import IR.VarDescriptor;
 
 public class FlowNode {
 
@@ -15,13 +17,21 @@ public class FlowNode {
   // this set contains fields of the base type
   private Set<FlowNode> fieldNodeSet;
 
+  // set true if this node is driven from a paramter
+  private boolean isParameter;
+
+  // set true if this node stores a return value
+  private boolean isReturn;
+
   public Set<FlowNode> getFieldNodeSet() {
     return fieldNodeSet;
   }
 
   private Set<FlowEdge> outEdgeSet;
 
-  public FlowNode(NTuple<Descriptor> tuple) {
+  public FlowNode(NTuple<Descriptor> tuple, boolean isParam) {
+
+    this.isParameter = isParam;
 
     NTuple<Descriptor> base = null;
     Descriptor desc = null;
@@ -46,6 +56,10 @@ public class FlowNode {
     fieldNodeSet.add(node);
   }
 
+  public boolean isParameter() {
+    return isParameter;
+  }
+
   public NTuple<Descriptor> getDescTuple() {
     return descTuple;
   }
@@ -54,8 +68,31 @@ public class FlowNode {
     return descTuple.get(descTuple.size() - 1);
   }
 
+  public boolean isReturn() {
+    return isReturn;
+  }
+
+  public void setReturn(boolean isReturn) {
+    this.isReturn = isReturn;
+  }
+
+  public boolean isPrimitiveType() {
+    Descriptor desc = descTuple.get(descTuple.size() - 1);
+    if (desc instanceof VarDescriptor) {
+      return ((VarDescriptor) desc).getType().isPrimitive();
+    } else if (desc instanceof FieldDescriptor) {
+      return ((FieldDescriptor) desc).getType().isPrimitive();
+    }
+    return false;
+  }
+
   public String toString() {
-    return "[FlowNode]::" + descTuple;
+    String rtr = "[FlowNode]:";
+    if (isParameter()) {
+      rtr += "param:";
+    }
+    rtr += ":" + descTuple;
+    return rtr;
   }
 
   public Iterator<FlowEdge> iteratorOfOutEdges() {