T - the return type of this Ifpublic final class If<T> extends AbstractProtelisAST<T>
| Constructor and Description |
|---|
If(Metadata metadata,
ProtelisAST<java.lang.Boolean> cond,
ProtelisAST<T> then,
ProtelisAST<T> otherwise) |
| Modifier and Type | Method and Description |
|---|---|
T |
evaluate(ExecutionContext context)
Evaluates this AST node.
|
Bytecode |
getBytecode() |
ProtelisAST<java.lang.Boolean> |
getConditionExpression() |
ProtelisAST<T> |
getElseExpression() |
ProtelisAST<T> |
getThenExpression() |
protected boolean |
isNullable() |
java.lang.String |
toString() |
branchesToString, branchesToString, eval, forEach, forEachWithIndex, getBranch, getBranches, getBranchesNumber, getMetadata, getName, stringForpublic If(@Nonnull
Metadata metadata,
@Nonnull
ProtelisAST<java.lang.Boolean> cond,
@Nonnull
ProtelisAST<T> then,
@Nonnull
ProtelisAST<T> otherwise)
metadata - A Metadata object containing information about the code that generated this AST node.cond - conditionthen - branch to execute if condition is true (erase otherwise)otherwise - branch to execute if condition is false (erase otherwise)public T evaluate(ExecutionContext context)
AbstractProtelisASTAbstractProtelisAST takes care of storing the necessary metadata.evaluate in class AbstractProtelisAST<T>context - the execution contextpublic ProtelisAST<java.lang.Boolean> getConditionExpression()
ProtelisAST of the condition expressionpublic ProtelisAST<T> getElseExpression()
ProtelisAST of the else expressionpublic ProtelisAST<T> getThenExpression()
ProtelisAST of the then expressionpublic java.lang.String toString()
toString in class AbstractProtelisAST<T>protected boolean isNullable()
isNullable in class AbstractProtelisAST<T>