com.speckled.specksim
Interface SpeckCapability

All Known Implementing Classes:
SpeckSim

public interface SpeckCapability

This interface represents the set of simulator capabilities exposed to Speck instances by default. Specks that require more of the simulator's functionality can simply cast to SpeckSim, but this is a bit naughty and opens up the avenue for cheating at being a speck

Author:
ryanm

Method Summary
 Environment getEnvironment(java.lang.String name)
          Gets an Environment object from the simulator
 float getTime()
          Gets the current simulation time
 void initiateBroadcast(Speck speck, Message m, MessageShell shell, MACProtocol mac)
          Initiates a broadcast
 void initiateBroadcast(Speck speck, MessageProducer mp, MessageShell shell, MACProtocol mac)
          Initiates a broadcast.
 void postEvent(SimulationEvent se)
          Post an event onto the queue.
 void removeEvent(SimulationEvent se)
          Removes an event from the event queue.
 void removeOwnedEvents(Speck owner)
          Remove all events with a particular Speck as an owner
 

Method Detail

getTime

float getTime()
Gets the current simulation time

Returns:
The number of simulated seconds that have passed.

initiateBroadcast

void initiateBroadcast(Speck speck,
                       Message m,
                       MessageShell shell,
                       MACProtocol mac)
Initiates a broadcast

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

initiateBroadcast

void initiateBroadcast(Speck speck,
                       MessageProducer mp,
                       MessageShell shell,
                       MACProtocol mac)
Initiates a broadcast. Allows construction of the message to be deferred until it is actually going to be transmitted

Parameters:
speck - The transmitting speck
mp - The provider of the method to transmit.
shell - The extents of the broadcast
mac - The MAC protocol that controls the broadcast

getEnvironment

Environment getEnvironment(java.lang.String name)
Gets an Environment object from the simulator

Parameters:
name - The name of the desired Environment object
Returns:
The named Environment object, or null if there is no such object

postEvent

void postEvent(SimulationEvent se)
Post an event onto the queue.

Parameters:
se - The event to post.

removeEvent

void removeEvent(SimulationEvent se)
Removes an event from the event queue.

Parameters:
se - The event to remove. Must be non-null

removeOwnedEvents

void removeOwnedEvents(Speck owner)
Remove all events with a particular Speck as an owner

Parameters:
owner - The owner Speck