Package it.unibo.alchemist.protelis
Class AlchemistNetworkManager
-
- All Implemented Interfaces:
-
java.io.Serializable
,org.protelis.vm.NetworkManager
public final class AlchemistNetworkManager implements NetworkManager, Serializable
Emulates a NetworkManager. This particular network manager does not send messages instantly. Instead, it records the last message to send, and only when simulateMessageArrival is called the transfer is actually performed.
-
-
Field Summary
Fields Modifier and Type Field Description private final Reaction<Object>
event
private final ProtelisDevice<?>
device
private final RunProtelisProgram<?>
program
private final Double
retentionTime
private final RealDistribution
distanceLossDistribution
-
Constructor Summary
Constructors Constructor Description AlchemistNetworkManager(Reaction<Object> event, ProtelisDevice<?> device, RunProtelisProgram<?> program, Double retentionTime, RealDistribution distanceLossDistribution)
AlchemistNetworkManager(Reaction<Object> event, ProtelisDevice<?> device, RunProtelisProgram<?> program, Double retentionTime)
AlchemistNetworkManager(Reaction<Object> event, ProtelisDevice<?> device, RunProtelisProgram<?> program)
AlchemistNetworkManager(Reaction<Object> event, RunProtelisProgram<?> program)
-
Method Summary
Modifier and Type Method Description final Reaction<Object>
getEvent()
This reaction stores the time at which the neighbor state is read. final ProtelisDevice<?>
getDevice()
The ProtelisDevice required to run Protelis. final RunProtelisProgram<?>
getProgram()
The action this network manager is associated with. final Double
getRetentionTime()
the message retention time, or NaN if all the messages get discarded as soon as a computation cycle is concluded. final RealDistribution
getDistanceLossDistribution()
the distribution connecting the distance to the packet loss. ImmutableMap<DeviceUID, Map<CodePath, Object>>
getNeighborState()
Unit
shareState(Map<CodePath, Object> toSend)
final Unit
simulateMessageArrival(Double currentTime)
Simulates the arrival of the message to other nodes. -
-
Constructor Detail
-
AlchemistNetworkManager
AlchemistNetworkManager(Reaction<Object> event, ProtelisDevice<?> device, RunProtelisProgram<?> program, Double retentionTime, RealDistribution distanceLossDistribution)
-
AlchemistNetworkManager
AlchemistNetworkManager(Reaction<Object> event, ProtelisDevice<?> device, RunProtelisProgram<?> program, Double retentionTime)
-
AlchemistNetworkManager
AlchemistNetworkManager(Reaction<Object> event, ProtelisDevice<?> device, RunProtelisProgram<?> program)
-
AlchemistNetworkManager
AlchemistNetworkManager(Reaction<Object> event, RunProtelisProgram<?> program)
-
-
Method Detail
-
getEvent
final Reaction<Object> getEvent()
This reaction stores the time at which the neighbor state is read.
-
getDevice
final ProtelisDevice<?> getDevice()
The ProtelisDevice required to run Protelis.
-
getProgram
final RunProtelisProgram<?> getProgram()
The action this network manager is associated with.
-
getRetentionTime
final Double getRetentionTime()
the message retention time, or NaN if all the messages get discarded as soon as a computation cycle is concluded.
-
getDistanceLossDistribution
final RealDistribution getDistanceLossDistribution()
the distribution connecting the distance to the packet loss.
-
getNeighborState
ImmutableMap<DeviceUID, Map<CodePath, Object>> getNeighborState()
-
shareState
Unit shareState(Map<CodePath, Object> toSend)
-
simulateMessageArrival
final Unit simulateMessageArrival(Double currentTime)
Simulates the arrival of the message to other nodes.
- Parameters:
currentTime
- the current simulation time (used to understand when a message should get dropped).
-
-
-
-