import java.util.Set;
import IR.Descriptor;
+import IR.FieldDescriptor;
+import IR.VarDescriptor;
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;
fieldNodeSet.add(node);
}
+ public boolean isParameter() {
+ return isParameter;
+ }
+
public NTuple<Descriptor> getDescTuple() {
return descTuple;
}
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() {