From 3fbba65fe272a5a8104b13cfd608ee69225a8aab Mon Sep 17 00:00:00 2001 From: jzhou Date: Tue, 30 Nov 2010 23:49:59 +0000 Subject: [PATCH] Missing files --- Robust/src/IR/Tree/SwitchBlockNode.java | 34 +++++++++++++++++++++ Robust/src/IR/Tree/SwitchLabelNode.java | 30 ++++++++++++++++++ Robust/src/IR/Tree/SwitchStatementNode.java | 27 ++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 Robust/src/IR/Tree/SwitchBlockNode.java create mode 100644 Robust/src/IR/Tree/SwitchLabelNode.java create mode 100644 Robust/src/IR/Tree/SwitchStatementNode.java diff --git a/Robust/src/IR/Tree/SwitchBlockNode.java b/Robust/src/IR/Tree/SwitchBlockNode.java new file mode 100644 index 00000000..d14479c9 --- /dev/null +++ b/Robust/src/IR/Tree/SwitchBlockNode.java @@ -0,0 +1,34 @@ +package IR.Tree; + +import java.util.Vector; + +public class SwitchBlockNode extends BlockStatementNode { + Vector switch_conds; + BlockNode switch_st; + + public SwitchBlockNode(Vector switch_conds, BlockNode switch_st) { + this.switch_conds = switch_conds; + this.switch_st = switch_st; + } + + public Vector 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 index 00000000..0d5bdc2f --- /dev/null +++ b/Robust/src/IR/Tree/SwitchLabelNode.java @@ -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 index 00000000..c4c2e7ea --- /dev/null +++ b/Robust/src/IR/Tree/SwitchStatementNode.java @@ -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; + } +} -- 2.34.1