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 **fake** Protelis VM to be used for testing.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    DummyContext(org.protelis.vm.NetworkManager networkManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    org.protelis.lang.datatype.DeviceUID
     
    static org.protelis.lang.datatype.Field<Double>
    hoodFailureField(org.protelis.vm.ExecutionContext self)
    Test utility.
    protected DummyContext
     
    org.protelis.lang.datatype.Field<Double>
    makeTestField(int entries)
    Test utility.
    static org.protelis.lang.datatype.Field<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
     
     

    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
  • Constructor Details

    • DummyContext

      public DummyContext()
    • DummyContext

      public DummyContext(org.protelis.vm.NetworkManager networkManager)
      Parameters:
      networkManager - the network manager to be used
  • Method Details

    • getCurrentTime

      public Number getCurrentTime()
    • getDeltaTime

      public Number getDeltaTime()
      Specified by:
      getDeltaTime in interface org.protelis.vm.ExecutionContext
      Overrides:
      getDeltaTime in class org.protelis.vm.impl.AbstractExecutionContext<DummyContext>
    • getDeviceUID

      public org.protelis.lang.datatype.DeviceUID getDeviceUID()
    • instance

      protected DummyContext instance()
      Specified by:
      instance in class org.protelis.vm.impl.AbstractExecutionContext<DummyContext>
    • makeTestField

      public org.protelis.lang.datatype.Field<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
    • makeTestField

      public static org.protelis.lang.datatype.Field<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
    • 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 String toString()
      Overrides:
      toString in class Object
    • hoodFailureField

      public static org.protelis.lang.datatype.Field<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