Package org.protelis.vm.impl
Class SimpleExecutionEnvironment
- java.lang.Object
-
- org.protelis.vm.impl.SimpleExecutionEnvironment
-
- All Implemented Interfaces:
ExecutionEnvironment
public final class SimpleExecutionEnvironment extends java.lang.Object implements ExecutionEnvironment
Simple implementation ofExecutionEnvironment.
-
-
Constructor Summary
Constructors Constructor Description SimpleExecutionEnvironment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit()Called just after the VM is executed, to finalize information of the execution for the environment.java.lang.Objectget(java.lang.String id)java.lang.Objectget(java.lang.String id, java.lang.Object defaultValue)booleanhas(java.lang.String id)java.util.Set<java.lang.String>keySet()booleanput(java.lang.String id, java.lang.Object v)java.lang.Objectremove(java.lang.String id)voidsetup()Called just before the VM is executed, to enable and preparations needed in the environment.
-
-
-
Method Detail
-
has
public boolean has(java.lang.String id)
- Specified by:
hasin interfaceExecutionEnvironment- Parameters:
id- the variable name- Returns:
- true if the variable is present
-
get
public java.lang.Object get(java.lang.String id)
- Specified by:
getin interfaceExecutionEnvironment- Parameters:
id- the variable name- Returns:
- the value of the variable if present, false otherwise
-
get
public java.lang.Object get(java.lang.String id, java.lang.Object defaultValue)- Specified by:
getin interfaceExecutionEnvironment- Parameters:
id- the variable namedefaultValue- a parameterizable default value- Returns:
- the value of the variable if present, defaultValue otherwise
-
put
public boolean put(java.lang.String id, java.lang.Object v)- Specified by:
putin interfaceExecutionEnvironment- Parameters:
id- the variable namev- the value that should be associated with id- Returns:
- true if there was previously a value associated with id, and false if not.
-
remove
public java.lang.Object remove(java.lang.String id)
- Specified by:
removein interfaceExecutionEnvironment- Parameters:
id- the variable name- Returns:
- Returns the value to which this map previously associated the key, or null if the map contained no mapping for the key.
-
keySet
public java.util.Set<java.lang.String> keySet()
- Specified by:
keySetin interfaceExecutionEnvironment- Returns:
- An unmodifiable set of the keys in the ExecutionEnvironment
-
commit
public void commit()
Description copied from interface:ExecutionEnvironmentCalled just after the VM is executed, to finalize information of the execution for the environment.- Specified by:
commitin interfaceExecutionEnvironment
-
setup
public void setup()
Description copied from interface:ExecutionEnvironmentCalled just before the VM is executed, to enable and preparations needed in the environment.- Specified by:
setupin interfaceExecutionEnvironment
-
-