public class CachingNetworkManager
extends java.lang.Object
implements org.protelis.vm.NetworkManager
| Constructor and Description |
|---|
CachingNetworkManager() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<org.protelis.lang.datatype.DeviceUID,java.util.Map<org.protelis.vm.CodePath,java.lang.Object>> |
getNeighborState()
Called by
ProtelisVM during execution to collect the most recent
information available from neighbors. |
java.util.Map<org.protelis.vm.CodePath,java.lang.Object> |
getSendCache()
External access to sending cache.
|
void |
receiveFromNeighbor(org.protelis.lang.datatype.DeviceUID neighbor,
java.util.Map<org.protelis.vm.CodePath,java.lang.Object> message)
External access to put messages into receive cache.
|
void |
removeNeighbor(org.protelis.lang.datatype.DeviceUID neighbor)
External access to note when a device is no longer a neighbor, wiping
cache.
|
void |
shareState(java.util.Map<org.protelis.vm.CodePath,java.lang.Object> toSend)
Called by
ProtelisVM during execution to send its current shared
state to neighbors. |
public java.util.Map<org.protelis.vm.CodePath,java.lang.Object> getSendCache()
public void receiveFromNeighbor(org.protelis.lang.datatype.DeviceUID neighbor,
java.util.Map<org.protelis.vm.CodePath,java.lang.Object> message)
neighbor - sendermessage - messege to be receivedpublic void removeNeighbor(org.protelis.lang.datatype.DeviceUID neighbor)
neighbor - to be removedpublic java.util.Map<org.protelis.lang.datatype.DeviceUID,java.util.Map<org.protelis.vm.CodePath,java.lang.Object>> getNeighborState()
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.getNeighborState in interface org.protelis.vm.NetworkManagerProtelisVM will not
change it either.public void shareState(java.util.Map<org.protelis.vm.CodePath,java.lang.Object> toSend)
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.shareState in interface org.protelis.vm.NetworkManagertoSend - Shared state to be transmitted to neighbors.