Package org.protelis.vm.impl
Class SimpleProgramImpl
- java.lang.Object
-
- org.protelis.vm.impl.SimpleProgramImpl
-
- All Implemented Interfaces:
java.io.Serializable,ProtelisProgram
public final class SimpleProgramImpl extends java.lang.Object implements ProtelisProgram
Base implementation ofProtelisProgram.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleProgramImpl(java.lang.String pName, ProtelisAST<?> program)SimpleProgramImpl(org.protelis.parser.protelis.ProtelisModule source, ProtelisAST<?> program)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectcompute(ExecutionContext context)Execute one round of computation of this Protelis program.java.lang.StringgetName()The name of the program.java.lang.StringtoString()
-
-
-
Constructor Detail
-
SimpleProgramImpl
public SimpleProgramImpl(org.protelis.parser.protelis.ProtelisModule source, ProtelisAST<?> program)- Parameters:
source- OriginalProtelisProgramparsed by Xtext. Used to get the module name.program- evaluation tree
-
SimpleProgramImpl
public SimpleProgramImpl(java.lang.String pName, ProtelisAST<?> program)- Parameters:
pName- Program nameprogram- evaluation tree
-
-
Method Detail
-
compute
public java.lang.Object compute(ExecutionContext context)
Description copied from interface:ProtelisProgramExecute one round of computation of this Protelis program.- Specified by:
computein interfaceProtelisProgram- Parameters:
context- The virtual machine environment in which computation will take place.- Returns:
- the result of the program's evaluation
-
getName
public java.lang.String getName()
Description copied from interface:ProtelisProgramThe name of the program.- Specified by:
getNamein interfaceProtelisProgram- Returns:
- Name of the program, or some default name if no specific name is provided
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-