add more comments
[IRC.git] / Robust / src / IR / Tree / IfStatementNode.java
1 package IR.Tree;
2
3 public class IfStatementNode extends BlockStatementNode {
4     ExpressionNode cond;
5     BlockNode true_st;
6     BlockNode else_st;
7     
8     public IfStatementNode(ExpressionNode cond, BlockNode true_st, BlockNode else_st) {
9         this.cond=cond;
10         this.true_st=true_st;
11         this.else_st=else_st;
12     }
13
14     public ExpressionNode getCondition() {
15         return cond;
16     }
17
18     public BlockNode getTrueBlock() {
19         return true_st;
20     }
21
22     public BlockNode getFalseBlock() {
23         return else_st;
24     }
25     
26     public String printNode(int indent) {
27         if (else_st==null)
28             return "if("+cond.printNode(indent)+") "+true_st.printNode(indent);
29         else 
30             return "if("+cond.printNode(indent)+") "+true_st.printNode(indent)+" else "+        else_st.printNode(indent);
31     }
32     public int kind() {
33         return Kind.IfStatementNode;
34     }
35 }