Class ConditionalSideEffect
- java.lang.Object
-
- org.protelis.lang.interpreter.impl.AbstractProtelisAST<Unit>
-
- org.protelis.lang.interpreter.impl.ConditionalSideEffect
-
- All Implemented Interfaces:
java.io.Serializable,ProtelisAST<Unit>,WithBytecode
public final class ConditionalSideEffect extends AbstractProtelisAST<Unit>
Branch with side effects, returnsUnit.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConditionalSideEffect(Metadata metadata, ProtelisAST<java.lang.Boolean> cond, ProtelisAST<?> then)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Unitevaluate(ExecutionContext context)Evaluates this AST node.BytecodegetBytecode()java.lang.StringtoString()-
Methods inherited from class org.protelis.lang.interpreter.impl.AbstractProtelisAST
branchesToString, branchesToString, eval, forEach, forEachWithIndex, getBranch, getBranches, getBranchesNumber, getMetadata, getName, isNullable, stringFor
-
-
-
-
Constructor Detail
-
ConditionalSideEffect
public ConditionalSideEffect(@Nonnull Metadata metadata, @Nonnull ProtelisAST<java.lang.Boolean> cond, @Nonnull ProtelisAST<?> then)- Parameters:
metadata- AMetadataobject containing information about the code that generated this AST node.cond- conditionthen- branch to execute if condition is true (erase otherwise)
-
-
Method Detail
-
evaluate
public Unit evaluate(ExecutionContext context)
Description copied from class:AbstractProtelisASTEvaluates this AST node. This method can throw any exception,AbstractProtelisASTtakes care of storing the necessary metadata.- Specified by:
evaluatein classAbstractProtelisAST<Unit>- Parameters:
context- the execution context- Returns:
- the result of the evaluation
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractProtelisAST<Unit>
-
-