Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.core.isdl.ast
Class IfStmt

    java.lang.Object
      avrora.core.isdl.ast.Stmt
          avrora.core.isdl.ast.IfStmt

public class IfStmt
extends Stmt

The `IfStmt` class represents a simple branch within the IR. Since loops and switch statements are not allowed, if statements (and subroutine calls) are the only form of control flow.

Field Summary
`Expr` | `cond` The `cond` field stores a reference to the expression that is evaluated as the condition determining which branch is executed.
`java.util.List` | `falseBranch` The `falseBranch` field stores a reference to the list of statements to be executed if the condition is false.
`java.util.List` | `trueBranch` The `trueBranch` field stores a reference to the list of statements to be executed if the condition is true.

Constructor Summary
`IfStmt(Expr c, java.util.List t, java.util.List f)` The constructor of the `IfStmt` class simply initializes the internal fields based on the parameters.

Method Summary
`Stmt` | `accept(StmtRebuilder r)` The `accept()` method implements one half of the visitor pattern for visiting the abstract syntax trees representing the code of a particular instruction or subroutine.
`void` | `accept(StmtVisitor v)` The `accept()` method implements one half of the visitor pattern for visiting the abstract syntax trees representing the code of a particular instruction or subroutine.
`java.lang.String` | `toString()` The `toString()` method recursively converts this statement to a string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### cond

    public final Expr cond

  The `cond` field stores a reference to the expression that is evaluated as the condition determining which branch is executed.

### trueBranch

    public final java.util.List trueBranch

  The `trueBranch` field stores a reference to the list of statements to be executed if the condition is true.

### falseBranch

    public final java.util.List falseBranch

  The `falseBranch` field stores a reference to the list of statements to be executed if the condition is false.

Constructor Detail

### IfStmt

    public IfStmt(Expr c,
                  java.util.List t,
                  java.util.List f)

  The constructor of the `IfStmt` class simply initializes the internal fields based on the parameters.

Parameters:
  `c` - a reference to the expression representing the condition
  `t` - a reference to the list of statements to execute if the condition evaluates to true
  `f` - a reference to the list of statements to execute if the condition evaluates to false

Method Detail

### accept

    public void accept(StmtVisitor v)

  The `accept()` method implements one half of the visitor pattern for visiting the abstract syntax trees representing the code of a particular instruction or subroutine.

  Specified by:
    `accept` in class `Stmt`
  Parameters:
    `v` - the visitor to accept

### toString

    public java.lang.String toString()

  The `toString()` method recursively converts this statement to a string.

  Returns:
    a string representation of this statement

### accept

    public Stmt accept(StmtRebuilder r)

  The `accept()` method implements one half of the visitor pattern for visiting the abstract syntax trees representing the code of a particular instruction or subroutine. The `StmtRebuilder` interface allows visitors to rearrange and rebuild the statements.

  Specified by:
    `accept` in class `Stmt`
  Parameters:
    `r` - the visitor to accept
  Returns:
    the result of calling the appropriate `visit()` of the rebuilder passed

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD