Package org.protelis.test.infrastructure
Class DummyDevice
- java.lang.Object
-
- org.protelis.vm.impl.AbstractExecutionContext<DummyDevice>
-
- org.protelis.test.infrastructure.DummyDevice
-
- All Implemented Interfaces:
org.protelis.vm.ExecutionContext
,org.protelis.vm.LocalizedDevice
,org.protelis.vm.SpatiallyEmbeddedDevice<java.lang.Double>
,org.protelis.vm.TimeAwareDevice<java.lang.Double>
public final class DummyDevice extends org.protelis.vm.impl.AbstractExecutionContext<DummyDevice> implements org.protelis.vm.SpatiallyEmbeddedDevice<java.lang.Double>, org.protelis.vm.LocalizedDevice, org.protelis.vm.TimeAwareDevice<java.lang.Double>
A simple implementation of a Protelis-based device, encapsulating aProtelisVM
and a network interface.
-
-
Constructor Summary
Constructors Constructor Description DummyDevice(it.unibo.alchemist.model.interfaces.Environment<java.lang.Object> environment, ProtelisNode node, it.unibo.alchemist.model.interfaces.Reaction<java.lang.Object> reaction, org.apache.commons.math3.random.RandomGenerator random, org.protelis.vm.NetworkManager netmgr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.protelis.lang.datatype.Tuple
getCoordinates()
java.lang.Number
getCurrentTime()
java.lang.Number
getDeltaTime()
org.protelis.lang.datatype.DeviceUID
getDeviceUID()
protected DummyDevice
instance()
org.protelis.lang.datatype.Field<java.lang.Double>
nbrDelay()
org.protelis.lang.datatype.Field<java.lang.Double>
nbrLag()
org.protelis.lang.datatype.Field<java.lang.Double>
nbrRange()
org.protelis.lang.datatype.Field<org.protelis.lang.datatype.Tuple>
nbrVector()
double
nextRandomDouble()
Note: this should be going away in the future, to be replaced by standard Java random.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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.protelis.vm.ExecutionContext
buildField, buildFieldDeferred, commit, getExecutionEnvironment, getPersistent, getVariable, newCallStackFrame, newCallStackFrame, putMultipleVariables, putVariable, restrictDomain, returnFromCallFrame, runInNewStackFrame, setGloballyAvailableReferences, setPersistent, setup
-
-
-
-
Constructor Detail
-
DummyDevice
public DummyDevice(it.unibo.alchemist.model.interfaces.Environment<java.lang.Object> environment, ProtelisNode node, it.unibo.alchemist.model.interfaces.Reaction<java.lang.Object> reaction, org.apache.commons.math3.random.RandomGenerator random, org.protelis.vm.NetworkManager netmgr)
- Parameters:
environment
- environmentnode
- nodereaction
- reactionrandom
- randomnetmgr
- netmgr
-
-
Method Detail
-
getDeviceUID
public org.protelis.lang.datatype.DeviceUID getDeviceUID()
- Specified by:
getDeviceUID
in interfaceorg.protelis.vm.ExecutionContext
-
getCurrentTime
public java.lang.Number getCurrentTime()
- Specified by:
getCurrentTime
in interfaceorg.protelis.vm.ExecutionContext
-
getDeltaTime
public java.lang.Number getDeltaTime()
- Specified by:
getDeltaTime
in interfaceorg.protelis.vm.ExecutionContext
- Overrides:
getDeltaTime
in classorg.protelis.vm.impl.AbstractExecutionContext<DummyDevice>
-
instance
protected DummyDevice instance()
- Specified by:
instance
in classorg.protelis.vm.impl.AbstractExecutionContext<DummyDevice>
-
nextRandomDouble
public double nextRandomDouble()
Note: this should be going away in the future, to be replaced by standard Java random.- Specified by:
nextRandomDouble
in interfaceorg.protelis.vm.ExecutionContext
- Returns:
- a double random value
-
nbrRange
public org.protelis.lang.datatype.Field<java.lang.Double> nbrRange()
- Specified by:
nbrRange
in interfaceorg.protelis.vm.SpatiallyEmbeddedDevice<java.lang.Double>
-
nbrDelay
public org.protelis.lang.datatype.Field<java.lang.Double> nbrDelay()
- Specified by:
nbrDelay
in interfaceorg.protelis.vm.TimeAwareDevice<java.lang.Double>
-
nbrLag
public org.protelis.lang.datatype.Field<java.lang.Double> nbrLag()
- Specified by:
nbrLag
in interfaceorg.protelis.vm.TimeAwareDevice<java.lang.Double>
-
getCoordinates
public org.protelis.lang.datatype.Tuple getCoordinates()
- Specified by:
getCoordinates
in interfaceorg.protelis.vm.LocalizedDevice
-
nbrVector
public org.protelis.lang.datatype.Field<org.protelis.lang.datatype.Tuple> nbrVector()
- Specified by:
nbrVector
in interfaceorg.protelis.vm.LocalizedDevice
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-