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
public final class DummyContext extends org.protelis.vm.impl.AbstractExecutionContext<DummyContext>
A **dummy** Protelis VM to be used for testing.
-
-
Constructor Summary
Constructors Constructor Description DummyContext()
DummyContext(org.protelis.vm.NetworkManager networkManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Number
getCurrentTime()
java.lang.Number
getDeltaTime()
org.protelis.lang.datatype.DeviceUID
getDeviceUID()
static org.protelis.lang.datatype.Field<java.lang.Double>
hoodFailureField(org.protelis.vm.ExecutionContext self)
Test utility.protected DummyContext
instance()
org.protelis.lang.datatype.Field<java.lang.Double>
makeTestField(int entries)
Test utility.static org.protelis.lang.datatype.Field<java.lang.Double>
makeTestField(org.protelis.vm.ExecutionContext self)
Test utility.org.protelis.lang.datatype.Field<org.protelis.lang.datatype.Tuple>
makeTupleTestField(int entries)
Test utility.double
nextRandomDouble()
java.lang.String
toString()
-
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
-
-
-
-
Method Detail
-
getCurrentTime
public java.lang.Number getCurrentTime()
-
getDeltaTime
public java.lang.Number getDeltaTime()
- Specified by:
getDeltaTime
in interfaceorg.protelis.vm.ExecutionContext
- Overrides:
getDeltaTime
in classorg.protelis.vm.impl.AbstractExecutionContext<DummyContext>
-
getDeviceUID
public org.protelis.lang.datatype.DeviceUID getDeviceUID()
-
instance
protected DummyContext instance()
- Specified by:
instance
in classorg.protelis.vm.impl.AbstractExecutionContext<DummyContext>
-
makeTestField
public org.protelis.lang.datatype.Field<java.lang.Double> makeTestField(int entries)
Test utility.- Parameters:
entries
- how many entries for the field- 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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
makeTestField
public static org.protelis.lang.datatype.Field<java.lang.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
-
hoodFailureField
public static org.protelis.lang.datatype.Field<java.lang.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
-
-