|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvisidia.simulation.Console
public class Console
Console is the simulator main class. It manages event&ack queues&handlers, as well as the servers and the list of processes. Console offers a listener possibility: one can connect to the console to listen some simulation events. For example, the GUI can connect to the console to update the display regarding to simulation events.
| Constructor Summary | |
|---|---|
Console(int simulationMode,
SimulationConstants.SimulationType simulationType,
Graph graph,
ObjectWriter writer,
ReplayInfo replayInfo)
Instantiates a new console. |
|
| Method Summary | |
|---|---|
int |
addAgentToVertex(Vertex vertex,
Agent ag)
Adds an agent to a specified vertex. |
void |
addCommandListener(CommandListener listener)
Adds a command listener. |
Agent |
createAgentOnVertex(Vertex v,
Agent agent)
Creates a new agent on vertex. |
void |
deadAgent(AgentProcess sender)
Dead agent. |
void |
generateDelayedCommandAck(VisidiaEvent event)
Generate delayed command ack. |
java.lang.Object[] |
getActiveAgents()
Gets the active agents. |
Agent |
getAgent(int agentId)
Gets the agent. |
java.util.Collection<Agent> |
getAgentsVertexCollection(int vertexId)
Returns the collection of agents which are on the vertex defined by its id. |
CommandListener[] |
getCommandListeners()
Gets the command listeners. |
int |
getCountNextPulse()
Gets the count next pulse. |
Graph |
getGraph()
Gets the graph. |
java.lang.Object |
getLockSyncObject()
Gets the lock sync object. |
int |
getNbProcesses()
Gets the number of processes. |
ProcessType |
getProcess(int processId)
Gets a process. |
int |
getPulse()
Gets the pulse. |
int |
getSimulationId()
Gets the simulation id. |
Statistics |
getStats()
Gets the stats. |
SimulationConstants.SimulationStatus |
getStatus()
Gets the simulation status. |
int |
getTerminatedAlgoStillMovingCount()
Gets the terminated algo still moving count. |
int |
getTerminatedThreadCount()
Gets the number of terminated threads. |
void |
killAgent(Agent agent)
Kill agent. |
void |
notifyAllLockSync()
Notify all threads waiting for lockSync object. |
void |
pause()
Pauses console. |
void |
putAlgorithmOnNodes(Algorithm algorithm)
Puts algorithm on nodes. |
int |
removeAgentFromVertex(Vertex vertex,
Agent ag)
Removes a specified agent from a specified vertex. |
void |
removeCommandListener(CommandListener listener)
Removes a command listener. |
void |
reset()
Resets console. |
void |
runCommand(Command cmd)
Runs a command. |
void |
runningControl()
Running control. |
void |
setCountNextPulse(int countNextPulse)
Sets the count next pulse. |
void |
setPulse(int pulse)
Sets the pulse. |
void |
setSimulationId(int simulationId)
Sets the simulation id. |
void |
setStats(Statistics stats)
Sets the stats. |
void |
setTerminatedAlgoStillMovingCount(int terminatedAlgoStillMovingCount)
Sets the terminated algo still moving count. |
void |
start()
Starts console. |
void |
stop()
Stops console. |
void |
switchVertexOnOff(Vertex vertex)
Switch vertex on/off. |
void |
terminatedAlgorithm(MessageProcess sender)
Counts terminated threads on the graph. |
void |
terminateSimulation()
Terminate simulation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Console(int simulationMode,
SimulationConstants.SimulationType simulationType,
Graph graph,
ObjectWriter writer,
ReplayInfo replayInfo)
simulationMode - the simulation modesimulationType - the simulation typegraph - the graphwriter - the writerreplayInfo - the replay info| Method Detail |
|---|
public int getSimulationId()
public void setSimulationId(int simulationId)
simulationId - the new simulation idpublic java.lang.Object getLockSyncObject()
public void notifyAllLockSync()
public int getCountNextPulse()
public void setCountNextPulse(int countNextPulse)
countNextPulse - the new count next pulsepublic int getPulse()
public void setPulse(int pulse)
pulse - the new pulsepublic int getTerminatedAlgoStillMovingCount()
public void setTerminatedAlgoStillMovingCount(int terminatedAlgoStillMovingCount)
terminatedAlgoStillMovingCount - the new terminated algo still moving countpublic final Graph getGraph()
public int getNbProcesses()
public int getTerminatedThreadCount()
public SimulationConstants.SimulationStatus getStatus()
public Statistics getStats()
public void setStats(Statistics stats)
stats - the new statspublic ProcessType getProcess(int processId)
processId - the process id
public java.util.Collection<Agent> getAgentsVertexCollection(int vertexId)
vertexId - the vertex id
public void addCommandListener(CommandListener listener)
listener - the listenerpublic void removeCommandListener(CommandListener listener)
listener - the listenerpublic CommandListener[] getCommandListeners()
public void runningControl()
public void reset()
public void start()
public void pause()
public void stop()
public void terminateSimulation()
public void terminatedAlgorithm(MessageProcess sender)
throws java.lang.InterruptedException
sender - the sender
java.lang.InterruptedException - the interrupted exception
public void deadAgent(AgentProcess sender)
throws java.lang.InterruptedException
sender - the sender
java.lang.InterruptedException - the interrupted exceptionpublic void putAlgorithmOnNodes(Algorithm algorithm)
algorithm - the algorithmpublic java.lang.Object[] getActiveAgents()
public Agent createAgentOnVertex(Vertex v,
Agent agent)
v - the vertexagent - the agent to clone
public Agent getAgent(int agentId)
agentId - the agent id
public int addAgentToVertex(Vertex vertex,
Agent ag)
vertex - the vertexag - the agent
public int removeAgentFromVertex(Vertex vertex,
Agent ag)
vertex - the vertexag - the agent
addAgentToVertex(Vertex, Agent)
public void runCommand(Command cmd)
throws java.lang.InterruptedException
cmd - the command
java.lang.InterruptedException - the interrupted exceptionpublic void generateDelayedCommandAck(VisidiaEvent event)
event - the eventpublic void switchVertexOnOff(Vertex vertex)
vertex - the vertexpublic void killAgent(Agent agent)
agent - the agent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||