com.speckled.specksim.imp.specks
Class VelocitySpeck

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

public class VelocitySpeck
extends AbstractSpeck

An extremely simple speck type. It just monitor's its own velocity

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
VelocitySpeck()
           
 
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.
 
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

VelocitySpeck

public VelocitySpeck()
Method Detail

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.


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.

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

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.

Returns:
A configurator object, or null if annotated