ast
Class IfStmt

java.lang.Object
  extended by ast.ASTNode
      extended by ast.Stmt
          extended by ast.IfStmt

public class IfStmt
extends Stmt

The IfStmt class represents a if-then-else statement appearing in a method declaration. It contains a predicate expression (predExpr), a then statement (thenStmt), and an else statement (elseStmt).

See Also:
ASTNode, Stmt

Field Summary
protected  Stmt elseStmt
          The else statement
protected  Expr predExpr
          The predicate expression
protected  Stmt thenStmt
          The then statement
 
Fields inherited from class ast.ASTNode
charNum, lineNum, lineStr
 
Constructor Summary
IfStmt(int lineNum, Expr predExpr, Stmt thenStmt, Stmt elseStmt)
          IfStmt constructor
 
Method Summary
 java.lang.Object accept(visitor.Visitor v, java.lang.Object o)
          Visitor method
 Stmt getElseStmt()
          Get the else statement
 Expr getPredExpr()
          Get the predicate expression
 Stmt getThenStmt()
          Get the then statement
 
Methods inherited from class ast.ASTNode
getLineNum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

predExpr

protected Expr predExpr
The predicate expression


thenStmt

protected Stmt thenStmt
The then statement


elseStmt

protected Stmt elseStmt
The else statement

Constructor Detail

IfStmt

public IfStmt(int lineNum,
              Expr predExpr,
              Stmt thenStmt,
              Stmt elseStmt)
IfStmt constructor

Parameters:
lineNum - source line number corresponding to this AST node
predExpr - the predicate expression
thenStmt - the then statement
elseStmt - the else statement
Method Detail

getPredExpr

public Expr getPredExpr()
Get the predicate expression

Returns:
prediate expression

getThenStmt

public Stmt getThenStmt()
Get the then statement

Returns:
then statement

getElseStmt

public Stmt getElseStmt()
Get the else statement

Returns:
else statement

accept

public java.lang.Object accept(visitor.Visitor v,
                               java.lang.Object o)
Visitor method

Specified by:
accept in class Stmt
Parameters:
v - visitor object
o - object to pass down
Returns:
result of visiting this node
See Also:
Visitor