fmrisc.AST
Class IfThenElseExpression

java.lang.Object
  extended byfmrisc.AST.ASTBase
      extended byfmrisc.AST.ExpressionBase
          extended byfmrisc.AST.IfThenElseExpression
All Implemented Interfaces:
AST, Expression

public final class IfThenElseExpression
extends ExpressionBase

Handling of if-then-else expressions.


Constructor Summary
IfThenElseExpression(Expression condition, Expression thenbranch, Expression elsebranch)
          construct if-then-else expressions from condition, thenbranch, elsebranch.
 
Method Summary
 Expression getCondition()
          get condition of expression
 Expression getElseBranch()
          get else branch of expression
 Expression getThenBranch()
          get then branch of expression
 Expression instantiate()
          return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers
 void printCore(java.io.PrintWriter out)
          Prints text representation of tree on out (without new line termination).
 
Methods inherited from class fmrisc.AST.ExpressionBase
printPriority
 
Methods inherited from class fmrisc.AST.ASTBase
print, printParens, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fmrisc.AST.AST
print, printParens, toString
 

Constructor Detail

IfThenElseExpression

public IfThenElseExpression(Expression condition,
                            Expression thenbranch,
                            Expression elsebranch)
construct if-then-else expressions from condition, thenbranch, elsebranch.

Parameters:
condition - the formula deciding which branch is selected
thenbranch - the branch selected if the formula yields true
Method Detail

getCondition

public Expression getCondition()
get condition of expression

Returns:
the condition

getThenBranch

public Expression getThenBranch()
get then branch of expression

Returns:
the then branch

getElseBranch

public Expression getElseBranch()
get else branch of expression

Returns:
the else branch

printCore

public void printCore(java.io.PrintWriter out)
Prints text representation of tree on out (without new line termination).

Specified by:
printCore in interface AST
Specified by:
printCore in class ASTBase
Parameters:
out - the stream on which the text is written

instantiate

public Expression instantiate()
return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers

Returns:
the instantiated copy