com.speckled.specksim.comm
Interface CommunicationModel

All Known Implementing Classes:
DefaultCommsModel

public interface CommunicationModel

Interface for the subsystem that controls communication. Implementation classes may be made Configurable, or annotated as such, and a gui will be generated

Author:
ryanm

Method Summary
 float broadcast(Speck speck, Message m, MessageShell shell)
          Simulate a broadcast
 boolean carrierSense(Speck speck, int channel)
          Detects if a speck is currently affected by a transmission
 java.lang.String getName()
          Gets the name of this communication model
 SerializableState getState()
          Gets a state object that will be passed to the gui
 void init(SpeckSim simulator)
          Called when the simulator is reset
 void initiateBroadcast(Speck speck, Message m, MessageShell shell, MACProtocol mac)
          Called by specks when they want to broadcast a message
 void initiateBroadcast(Speck speck, MessageProducer mp, MessageShell shell, MACProtocol mac)
          Called by specks when they want to broadcast a message.
 float isBroadcasting(Speck speck, int channel)
          Determines if a speck is currently broadcasting on a given channel
 

Method Detail

getName

java.lang.String getName()
Gets the name of this communication model

Returns:
the name of this model

init

void init(SpeckSim simulator)
Called when the simulator is reset

Parameters:
simulator - The simulator

isBroadcasting

float isBroadcasting(Speck speck,
                     int channel)
Determines if a speck is currently broadcasting on a given channel

Parameters:
speck - The speck to test for
channel - The channel to test for
Returns:
The predicted end time for the transmission, or -1 if the speck is not transmitting

carrierSense

boolean carrierSense(Speck speck,
                     int channel)
Detects if a speck is currently affected by a transmission

Parameters:
speck - The speck to test for
channel - The channel to test in
Returns:
true if the speck is affected by a broadcast in the specified channel, false otherwise

broadcast

float broadcast(Speck speck,
                Message m,
                MessageShell shell)
Simulate a broadcast

Parameters:
speck - The broadcasting speck
m - The message to broadcast
shell - The extents of the broadcast
Returns:
The time at which the broadcast will end

initiateBroadcast

void initiateBroadcast(Speck speck,
                       Message m,
                       MessageShell shell,
                       MACProtocol mac)
Called by specks when they want to broadcast a message

Parameters:
speck - The transmitting speck
m - The message to transmit
shell - The extents of the broadcast
mac - The MAC protocol that will control the transmission

initiateBroadcast

void initiateBroadcast(Speck speck,
                       MessageProducer mp,
                       MessageShell shell,
                       MACProtocol mac)
Called by specks when they want to broadcast a message. Allows the speck to defer constructing the message until it is actually going to be transmitted.

Parameters:
speck - The transmitting speck
mp - An object that will provide the message to be transmitted when the time comes
shell - The extents of the broadcast
mac - The MAC protocol that will control the transmission

getState

SerializableState getState()
Gets a state object that will be passed to the gui

Returns:
A state object to pass to the gui