Class 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 a ProtelisVM 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 - environment
        node - node
        reaction - reaction
        random - random
        netmgr - netmgr
    • Method Detail

      • getDeviceUID

        public org.protelis.lang.datatype.DeviceUID getDeviceUID()
        Specified by:
        getDeviceUID in interface org.protelis.vm.ExecutionContext
      • getCurrentTime

        public java.lang.Number getCurrentTime()
        Specified by:
        getCurrentTime in interface org.protelis.vm.ExecutionContext
      • getDeltaTime

        public java.lang.Number getDeltaTime()
        Specified by:
        getDeltaTime in interface org.protelis.vm.ExecutionContext
        Overrides:
        getDeltaTime in class org.protelis.vm.impl.AbstractExecutionContext<DummyDevice>
      • instance

        protected DummyDevice instance()
        Specified by:
        instance in class org.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 interface org.protelis.vm.ExecutionContext
        Returns:
        a double random value
      • nbrRange

        public org.protelis.lang.datatype.Field<java.lang.Double> nbrRange()
        Specified by:
        nbrRange in interface org.protelis.vm.SpatiallyEmbeddedDevice<java.lang.Double>
      • nbrDelay

        public org.protelis.lang.datatype.Field<java.lang.Double> nbrDelay()
        Specified by:
        nbrDelay in interface org.protelis.vm.TimeAwareDevice<java.lang.Double>
      • nbrLag

        public org.protelis.lang.datatype.Field<java.lang.Double> nbrLag()
        Specified by:
        nbrLag in interface org.protelis.vm.TimeAwareDevice<java.lang.Double>
      • getCoordinates

        public org.protelis.lang.datatype.Tuple getCoordinates()
        Specified by:
        getCoordinates in interface org.protelis.vm.LocalizedDevice
      • nbrVector

        public org.protelis.lang.datatype.Field<org.protelis.lang.datatype.Tuple> nbrVector()
        Specified by:
        nbrVector in interface org.protelis.vm.LocalizedDevice
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object