com.speckled.specksim.imp.specks
Class CollisionSpeck

java.lang.Object
  extended by com.speckled.specksim.imp.specks.AbstractSpeck
      extended by com.speckled.specksim.imp.specks.CollisionSpeck
All Implemented Interfaces:
Configurable, ToggleableBeacon, Speck

public class CollisionSpeck
extends AbstractSpeck
implements ToggleableBeacon

This speck type continually broadcasts extremely long messages. I used it to test the broadcast collision code

Author:
ryanm

Field Summary
 
Fields inherited from class com.speckled.specksim.imp.specks.AbstractSpeck
name, RNG_OFFSET_CONF_DESC, RNG_OFFSET_CONF_NAME, simulator
 
Fields inherited from interface com.speckled.specksim.Speck
ID_BITS, SPECK_LOG_SOURCE
 
Constructor Summary
CollisionSpeck()
          Standard constructor
 
Method Summary
 void deInit()
          Called when the speck is removed from the simulator.
 Configurator getConfigurator()
          Gets a Configurator object that describes and can manipulate the variables of this Configurable.
 SpeckState getState()
          Takes a snapshot of the state of this speck.
 void init()
          Called when the speck is added to the simulator, and when the simulator is reset.
 void shellEncountered(Speck sender, MessageShell shell, Message message)
          Called when the simulator determines that this speck lies within the bounds of a transmission.
 void toggleBeacon()
          Toggles the speck's beacon status
 
Methods inherited from class com.speckled.specksim.imp.specks.AbstractSpeck
getFlavourName, getRandom, getRandomSeedOffset, id, initialise, isLoggingEnabled, setID, setLoggingEnabled, setRandomSeedOffset, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollisionSpeck

public CollisionSpeck()
Standard constructor

Method Detail

toggleBeacon

public void toggleBeacon()
Description copied from interface: ToggleableBeacon
Toggles the speck's beacon status

Specified by:
toggleBeacon in interface ToggleableBeacon

init

public void init()
Description copied from class: AbstractSpeck
Called when the speck is added to the simulator, and when the simulator is reset. Would be a good place to reset the speck's fields and post your events.

Specified by:
init in class AbstractSpeck

deInit

public void deInit()
Description copied from interface: Speck
Called when the speck is removed from the simulator. Might be a good place to remove your events or clean up other state. Note that all SimulationEvents that have this speck as a parent will automatically be removed for you.

Specified by:
deInit in interface Speck

shellEncountered

public void shellEncountered(Speck sender,
                             MessageShell shell,
                             Message message)
Description copied from interface: Speck
Called when the simulator determines that this speck lies within the bounds of a transmission.

Specified by:
shellEncountered in interface Speck
Parameters:
sender - The speck that sent the message
shell - The shell used to send the message
message - The content of the message

getState

public SpeckState getState()
Description copied from interface: Speck
Takes a snapshot of the state of this speck. For performance reasons, it is advisable that each Speck should keep a reference to one SpeckState object, and simply update and return it when this is called

Specified by:
getState in interface Speck
Returns:
A SpeckState object that encapsulates the state of this speck at the current time

getConfigurator

public Configurator getConfigurator()
Description copied from interface: Configurable
Gets a Configurator object that describes and can manipulate the variables of this Configurable. This method must only return null if the Configurable object is Annotated such that an AnnotatedConfigurator can be built from it.

Specified by:
getConfigurator in interface Configurable
Returns:
A configurator object, or null if annotated