--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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;
+ }
+}