Package org.protelis.test.infrastructure
Class DummyContext
java.lang.Object
org.protelis.vm.impl.AbstractExecutionContext<DummyContext>
org.protelis.test.infrastructure.DummyContext
- All Implemented Interfaces:
org.protelis.vm.ExecutionContext
A **fake** Protelis VM to be used for testing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.protelis.lang.datatype.DeviceUIDstatic org.protelis.lang.datatype.Field<Double>hoodFailureField(org.protelis.vm.ExecutionContext self) Test utility.protected DummyContextinstance()org.protelis.lang.datatype.Field<Double>makeTestField(int entries) Test utility.static org.protelis.lang.datatype.Field<Double>makeTestField(org.protelis.vm.ExecutionContext self) Test utility.org.protelis.lang.datatype.Field<org.protelis.lang.datatype.Tuple>makeTupleTestField(int entries) Test utility.doubletoString()Methods inherited from class org.protelis.vm.impl.AbstractExecutionContext
buildField, buildFieldDeferred, commit, commitRecursively, getExecutionEnvironment, getFunctions, getNetworkManager, getPersistent, getStoredState, getVariable, newCallStackFrame, newCallStackFrame, putMultipleVariables, putVariable, restrictDomain, returnFromCallFrame, runInNewStackFrame, setGloballyAvailableReferences, setPersistent, setup
-
Constructor Details
-
DummyContext
public DummyContext() -
DummyContext
public DummyContext(org.protelis.vm.NetworkManager networkManager) - Parameters:
networkManager- the network manager to be used
-
-
Method Details
-
getCurrentTime
-
getDeltaTime
- Specified by:
getDeltaTimein interfaceorg.protelis.vm.ExecutionContext- Overrides:
getDeltaTimein classorg.protelis.vm.impl.AbstractExecutionContext<DummyContext>
-
getDeviceUID
public org.protelis.lang.datatype.DeviceUID getDeviceUID() -
instance
- Specified by:
instancein classorg.protelis.vm.impl.AbstractExecutionContext<DummyContext>
-
makeTestField
Test utility.- Parameters:
entries- how many entries for the field- Returns:
- a field with populated with numbers from 0 to 99
-
makeTestField
public static org.protelis.lang.datatype.Field<Double> makeTestField(org.protelis.vm.ExecutionContext self) Test utility.- Parameters:
self- the current Context- Returns:
- a field with populated with numbers from 0 to 99
-
makeTupleTestField
public org.protelis.lang.datatype.Field<org.protelis.lang.datatype.Tuple> makeTupleTestField(int entries) Test utility.- Parameters:
entries- how many entries for the field- Returns:
- a field with populated with tuples of numbers from 0 to 99
-
nextRandomDouble
public double nextRandomDouble() -
toString
-
hoodFailureField
public static org.protelis.lang.datatype.Field<Double> hoodFailureField(org.protelis.vm.ExecutionContext self) Test utility.- Parameters:
self- the current Context- Returns:
- a field with populated with numbers from 0 to 99
-