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 aProtelisVMand 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.TuplegetCoordinates()java.lang.NumbergetCurrentTime()java.lang.NumbergetDeltaTime()org.protelis.lang.datatype.DeviceUIDgetDeviceUID()protected DummyDeviceinstance()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()doublenextRandomDouble()Note: this should be going away in the future, to be replaced by standard Java random.java.lang.StringtoString()-
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:
getDeviceUIDin interfaceorg.protelis.vm.ExecutionContext
-
getCurrentTime
public java.lang.Number getCurrentTime()
- Specified by:
getCurrentTimein interfaceorg.protelis.vm.ExecutionContext
-
getDeltaTime
public java.lang.Number getDeltaTime()
- Specified by:
getDeltaTimein interfaceorg.protelis.vm.ExecutionContext- Overrides:
getDeltaTimein classorg.protelis.vm.impl.AbstractExecutionContext<DummyDevice>
-
instance
protected DummyDevice instance()
- Specified by:
instancein 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:
nextRandomDoublein interfaceorg.protelis.vm.ExecutionContext- Returns:
- a double random value
-
nbrRange
public org.protelis.lang.datatype.Field<java.lang.Double> nbrRange()
- Specified by:
nbrRangein interfaceorg.protelis.vm.SpatiallyEmbeddedDevice<java.lang.Double>
-
nbrDelay
public org.protelis.lang.datatype.Field<java.lang.Double> nbrDelay()
- Specified by:
nbrDelayin interfaceorg.protelis.vm.TimeAwareDevice<java.lang.Double>
-
nbrLag
public org.protelis.lang.datatype.Field<java.lang.Double> nbrLag()
- Specified by:
nbrLagin interfaceorg.protelis.vm.TimeAwareDevice<java.lang.Double>
-
getCoordinates
public org.protelis.lang.datatype.Tuple getCoordinates()
- Specified by:
getCoordinatesin interfaceorg.protelis.vm.LocalizedDevice
-
nbrVector
public org.protelis.lang.datatype.Field<org.protelis.lang.datatype.Tuple> nbrVector()
- Specified by:
nbrVectorin interfaceorg.protelis.vm.LocalizedDevice
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-