Class Constant<T>
- java.lang.Object
-
- org.protelis.lang.interpreter.impl.AbstractProtelisAST<T>
-
- org.protelis.lang.interpreter.impl.Constant<T>
-
- Type Parameters:
T- the type of the constant
- All Implemented Interfaces:
java.io.Serializable,ProtelisAST<T>,WithBytecode
- Direct Known Subclasses:
NumericConstant
public class Constant<T> extends AbstractProtelisAST<T>
An arbitrary object-valued constant.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tevaluate(ExecutionContext context)Evaluates this AST node.BytecodegetBytecode()TgetConstantValue()java.lang.StringgetName()java.lang.StringtoString()-
Methods inherited from class org.protelis.lang.interpreter.impl.AbstractProtelisAST
branchesToString, branchesToString, eval, forEach, forEachWithIndex, getBranch, getBranches, getBranchesNumber, getMetadata, isNullable, stringFor
-
-
-
-
Method Detail
-
evaluate
public final T 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<T>- Parameters:
context- the execution context- Returns:
- the result of the evaluation
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceProtelisAST<T>- Overrides:
getNamein classAbstractProtelisAST<T>- Returns:
- The name of the operation
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractProtelisAST<T>
-
getConstantValue
public final T getConstantValue()
- Returns:
- the value associated to this constant
-
-