|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.speckled.specksim.SpeckSim
public class SpeckSim
The main class of the simulator.
| Field Summary | |
|---|---|
static java.lang.String |
SIM_SOURCE
The logging source for logging events in the simulator |
| Method Summary | |
|---|---|
void |
addCommsModelListener(CommunicationModelListener listener)
Registers a MessageListener's interest. |
void |
addExecutionListener(ExecutionListener listener)
Registers an ExecutionListener's interest. |
void |
addMovementModelListener(MovementModelListener listener)
Registers a MovementModelListener's interest. |
void |
addPopulationListener(PopulationListener listener)
Register's a PopulationListener's interest. |
void |
addSpeck(Speck speck)
Adds a speck to the simulator |
void |
addWallListener(WallListener listener)
Register an object's interest in changes to the walls |
void |
advanceToTime(float time)
Advances the state of the simulation to the specified time |
int |
countSpecks()
Gets the number of specks, of all flavours, in the simulator |
int |
countSpecks(java.lang.String name)
Gets the number of specks of a given flavour in the simulator |
int |
findSpeckIndex(Speck speck)
Finds the index of a given speck in the master list of specks |
static SpeckSim |
getandResetSimulator()
Gets the SpeckSim instance and resets it. |
CommunicationModel |
getCommunicationModel()
Gets the current communications model |
Configurator |
getConfigurator()
Gets a Configurator object that describes and can manipulate the variables of this Configurable. |
Environment |
getEnvironment(java.lang.String name)
Gets an Environment object from the simulator |
java.lang.String[] |
getEnvironmentNames()
Gets an array containing the name sof available Environment objects |
MovementModel |
getMovementModel()
Gets the current movement model |
static SpeckSim |
getSimulator()
Gets the SpeckSim instance |
java.util.Iterator<Speck> |
getSpecks()
Gets an iterator over all the specks. |
java.util.Iterator<Speck> |
getSpecks(java.lang.String name)
Gets an iterator over all the specks of a given flavour. |
SimulatorState |
getState()
Gets a SimulatorState object from the source |
float |
getTime()
Gets the current simulation time |
WallManager |
getWallManager()
Gets the WallManager. |
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. |
float |
peekNextEventTime()
Peeks at the next pending event, and returns its event time |
void |
postEvent(SimulationEvent se)
Post an event onto the queue. |
java.lang.String |
printEventQueue()
Builds and returns a string representation of the current state of the event queue |
void |
removeCommsModelListener(CommunicationModelListener listener)
Registers a MessageListener's boredom. |
void |
removeEvent(SimulationEvent se)
Removes an event from the event queue. |
void |
removeExecutionListener(ExecutionListener listener)
Registers an ExecutionListener's boredom. |
void |
removeMovementModelListener(MovementModelListener listener)
Registers a MovementModelListener's boredom. |
void |
removeOwnedEvents(Speck owner)
Remove all events with a particular Speck as an owner |
void |
removePopulationListener(PopulationListener listener)
Register's a PopulationListener's boredom. |
void |
removeSpeck(Speck speck)
Removes a speck from the simulator |
void |
removeWallListener(WallListener listener)
Register an object's disinterest in changes to the walls |
void |
reset()
Resets this simulator's state to time 0 |
void |
setCommunicationModel(CommunicationModel model)
Sets the active CommunicationModel |
void |
setMovementModel(MovementModel mm)
Sets the current movement model |
void |
setNumberOfSpecks(java.lang.String type,
int n)
Sets the number of specks of a given type in the simulation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SIM_SOURCE
| Method Detail |
|---|
public static SpeckSim getandResetSimulator()
SpeckSim instance and resets it. All extension
classes, ( Speck implementations, MovementModels, etc ) should
be registered before the first call to this method is made
SpeckSim objectpublic static SpeckSim getSimulator()
SpeckSim instance
SpeckSim objectpublic WallManager getWallManager()
WallManager.
WallManagerpublic void reset()
public float getTime()
SpeckCapability
getTime in interface SpeckCapabilitypublic SimulatorState getState()
StateSourceSimulatorState object from the source
getState in interface StateSourceSimulatorState objectpublic void setMovementModel(MovementModel mm)
mm - The new movement modelpublic MovementModel getMovementModel()
public void setCommunicationModel(CommunicationModel model)
CommunicationModel
model - The new modelpublic CommunicationModel getCommunicationModel()
public void setNumberOfSpecks(java.lang.String type,
int n)
type - The name of the speck typen - The desired number of speckspublic void addSpeck(Speck speck)
speck - The speck to addpublic void removeSpeck(Speck speck)
speck - The speck to removepublic int findSpeckIndex(Speck speck)
speck - The speck to find
public java.util.Iterator<Speck> getSpecks()
public java.util.Iterator<Speck> getSpecks(java.lang.String name)
name - The name of the speck flavour
public int countSpecks()
public int countSpecks(java.lang.String name)
name - The speck flavour name
public void initiateBroadcast(Speck speck,
Message m,
MessageShell shell,
MACProtocol mac)
SpeckCapability
initiateBroadcast in interface SpeckCapabilityspeck - The transmitting speckm - The message to transmitshell - The extents of the broadcastmac - The MAC protocol that controls the broadcast
public void initiateBroadcast(Speck speck,
MessageProducer mp,
MessageShell shell,
MACProtocol mac)
SpeckCapability
initiateBroadcast in interface SpeckCapabilityspeck - The transmitting speckmp - The provider of the method to transmit.shell - The extents of the broadcastmac - The MAC protocol that controls the broadcastpublic void advanceToTime(float time)
time - The target time that the simulation will be at when
the method returnspublic void postEvent(SimulationEvent se)
SpeckCapability
postEvent in interface SpeckCapabilityse - The event to post.public float peekNextEventTime()
public void removeEvent(SimulationEvent se)
SpeckCapability
removeEvent in interface SpeckCapabilityse - The event to remove. Must be non-nullpublic void removeOwnedEvents(Speck owner)
SpeckCapability
removeOwnedEvents in interface SpeckCapabilityowner - The owner Speckpublic void addMovementModelListener(MovementModelListener listener)
listener - the listener to addpublic void removeMovementModelListener(MovementModelListener listener)
listener - the listener to removepublic void addExecutionListener(ExecutionListener listener)
listener - the listener to add. Adding the same listener multiple
times will have no effect - it will still only be
notified oncepublic void removeExecutionListener(ExecutionListener listener)
listener - the listener to removepublic void addCommsModelListener(CommunicationModelListener listener)
listener - The listener to add. Adding the same listener multiple
times will have no effect - it will still only be
notified oncepublic void removeCommsModelListener(CommunicationModelListener listener)
listener - The listener to removepublic void addPopulationListener(PopulationListener listener)
listener - The listener to add. Adding the same listener multiple
times will have no effect - it will still only be
notified oncepublic void removePopulationListener(PopulationListener listener)
listener - The listener to removepublic void addWallListener(WallListener listener)
listener - the interested object. Adding the same listener
multiple times will have no effect - it will still
only be notified oncepublic void removeWallListener(WallListener listener)
listener - the disinterested objectpublic Configurator getConfigurator()
Configurable
getConfigurator in interface Configurablepublic java.lang.String printEventQueue()
public java.lang.String[] getEnvironmentNames()
Environment objects
Environment objectspublic Environment getEnvironment(java.lang.String name)
SpeckCapabilityEnvironment object from the simulator
getEnvironment in interface SpeckCapabilityname - The name of the desired Environment object
Environment object, or null if there
is no such object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||