Class SimpleNetworkManager

  • All Implemented Interfaces:
    NetworkManager

    public final class SimpleNetworkManager
    extends java.lang.Object
    implements NetworkManager
    Stub network manager for testing, in which there are no neighbors and no messages are ever sent.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<DeviceUID,​java.util.Map<CodePath,​java.lang.Object>> getNeighborState()
      Called by ProtelisVM during execution to collect the most recent information available from neighbors.
      void shareState​(java.util.Map<CodePath,​java.lang.Object> toSend)
      Called by ProtelisVM during execution to send its current shared state to neighbors.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleNetworkManager

        public SimpleNetworkManager()
    • Method Detail

      • getNeighborState

        public java.util.Map<DeviceUID,​java.util.Map<CodePath,​java.lang.Object>> getNeighborState()
        Description copied from interface: NetworkManager
        Called by ProtelisVM during execution to collect the most recent information available from neighbors. The call is serial within the execution, so this should probably poll state maintained by a separate thread, rather than gathering state during this call.
        Specified by:
        getNeighborState in interface NetworkManager
        Returns:
        A map associating each neighbor with its shared state. The object returned should not be modified, and ProtelisVM will not change it either.
      • shareState

        public void shareState​(java.util.Map<CodePath,​java.lang.Object> toSend)
        Description copied from interface: NetworkManager
        Called by ProtelisVM during execution to send its current shared state to neighbors. The call is serial within the execution, so this should probably queue up a message to be sent, rather than actually carrying out a lengthy operations during this call.
        Specified by:
        shareState in interface NetworkManager
        Parameters:
        toSend - Shared state to be transmitted to neighbors.