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<Double>, org.protelis.vm.TimeAwareDevice<Double>

public final class DummyDevice extends org.protelis.vm.impl.AbstractExecutionContext<DummyDevice> implements org.protelis.vm.SpatiallyEmbeddedDevice<Double>, org.protelis.vm.LocalizedDevice, org.protelis.vm.TimeAwareDevice<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<Object> environment, ProtelisNode node, it.unibo.alchemist.model.interfaces.Reaction<Object> reaction, org.apache.commons.math3.random.RandomGenerator random, org.protelis.vm.NetworkManager networkManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.protelis.lang.datatype.Tuple
     
     
     
    org.protelis.lang.datatype.DeviceUID
     
    protected DummyDevice
     
    org.protelis.lang.datatype.Field<Double>
     
    org.protelis.lang.datatype.Field<Double>
     
    org.protelis.lang.datatype.Field<Double>
     
    org.protelis.lang.datatype.Field<org.protelis.lang.datatype.Tuple>
     
    double
    Note: this should be going away in the future, to be replaced by standard Java random.
     

    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 Details

    • DummyDevice

      public DummyDevice(it.unibo.alchemist.model.interfaces.Environment<Object> environment, ProtelisNode node, it.unibo.alchemist.model.interfaces.Reaction<Object> reaction, org.apache.commons.math3.random.RandomGenerator random, org.protelis.vm.NetworkManager networkManager)
      Parameters:
      environment - environment
      node - node
      reaction - reaction
      random - random
      networkManager - networkManager
  • Method Details

    • getDeviceUID

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

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

      public 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<Double> nbrRange()
      Specified by:
      nbrRange in interface org.protelis.vm.SpatiallyEmbeddedDevice<Double>
    • nbrDelay

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

      public org.protelis.lang.datatype.Field<Double> nbrLag()
      Specified by:
      nbrLag in interface org.protelis.vm.TimeAwareDevice<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 String toString()
      Overrides:
      toString in class Object