Missing files
authorjzhou <jzhou>
Tue, 30 Nov 2010 23:49:59 +0000 (23:49 +0000)
committerjzhou <jzhou>
Tue, 30 Nov 2010 23:49:59 +0000 (23:49 +0000)
Robust/src/IR/Tree/SwitchBlockNode.java [new file with mode: 0644]
Robust/src/IR/Tree/SwitchLabelNode.java [new file with mode: 0644]
Robust/src/IR/Tree/SwitchStatementNode.java [new file with mode: 0644]

diff --git a/Robust/src/IR/Tree/SwitchBlockNode.java b/Robust/src/IR/Tree/SwitchBlockNode.java
new file mode 100644 (file)
index 0000000..d14479c
--- /dev/null
@@ -0,0 +1,34 @@
+package IR.Tree;
+
+import java.util.Vector;
+
+public class SwitchBlockNode extends BlockStatementNode {
+  Vector<SwitchLabelNode> switch_conds;
+  BlockNode switch_st;
+
+  public SwitchBlockNode(Vector<SwitchLabelNode> switch_conds, BlockNode switch_st) {
+    this.switch_conds = switch_conds;
+    this.switch_st = switch_st;
+  }
+
+  public Vector<SwitchLabelNode> getSwitchConditions() {
+    return this.switch_conds;
+  }
+  
+  public BlockNode getSwitchBlockStatement() {
+    return this.switch_st;
+  }
+
+  public String printNode(int indent) {
+    String result = "";
+    for(int i = 0; i < this.switch_conds.size(); i++) {
+      result += this.switch_conds.elementAt(i).printNode(indent);
+    }
+    result += this.switch_st.printNode(indent);
+    return result;
+  }
+  
+  public int kind() {
+    return Kind.SwitchBlockNode;
+  }
+}
\ No newline at end of file
diff --git a/Robust/src/IR/Tree/SwitchLabelNode.java b/Robust/src/IR/Tree/SwitchLabelNode.java
new file mode 100644 (file)
index 0000000..0d5bdc2
--- /dev/null
@@ -0,0 +1,30 @@
+package IR.Tree;
+
+public class SwitchLabelNode extends BlockStatementNode {
+  ExpressionNode cond;
+  boolean isdefault;
+
+  public SwitchLabelNode(ExpressionNode cond, boolean isdefault) {
+    this.cond = cond;
+    this.isdefault = isdefault;
+  }
+
+  public ExpressionNode getCondition() {
+    return cond;
+  }
+  
+  public boolean isDefault() {
+    return this.isdefault;
+  }
+
+  public String printNode(int indent) {
+    if(this.isdefault) {
+      return "case default: ";
+    }
+    return "case " + cond.printNode(indent) + ": ";
+  }
+  
+  public int kind() {
+    return Kind.SwitchLabelNode;
+  }
+}
\ No newline at end of file
diff --git a/Robust/src/IR/Tree/SwitchStatementNode.java b/Robust/src/IR/Tree/SwitchStatementNode.java
new file mode 100644 (file)
index 0000000..c4c2e7e
--- /dev/null
@@ -0,0 +1,27 @@
+package IR.Tree;
+
+public class SwitchStatementNode extends BlockStatementNode {
+  ExpressionNode cond;
+  BlockNode switch_st;
+
+  public SwitchStatementNode(ExpressionNode cond, BlockNode switch_st) {
+    this.cond = cond;
+    this.switch_st = switch_st;
+  }
+
+  public ExpressionNode getCondition() {
+    return cond;
+  }
+  
+  public BlockNode getSwitchBody() {
+    return this.switch_st;
+  }
+
+  public String printNode(int indent) {
+    return "switch(" + cond.printNode(indent) + ") " + switch_st.printNode(indent);
+  }
+  
+  public int kind() {
+    return Kind.SwitchStatementNode;
+  }
+}