|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjutil.Simulator
public class Simulator
The Sim framework consists of the Simulator, Events, and priority queue.
| Field Summary | |
|---|---|
protected int |
clock
The simulated time. |
protected boolean |
debug
Set to true to see the clock and event queue after each event is fired. |
protected PriorityQueue |
events
Scheduled events are placed in this queue in order of their firing times. |
| Constructor Summary | |
|---|---|
Simulator()
Initializes event queue as a binary heap. |
|
Simulator(PriorityQueue q)
|
|
| Method Summary | |
|---|---|
protected void |
handle(java.lang.Exception e)
Handles errors by terminating the simulation. |
void |
run()
Repeatedly removes the next event from the event queue, updates the clock, and fires the event. |
void |
schedule(Event e)
Adds events to the events queue. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected PriorityQueue events
protected int clock
protected boolean debug
| Constructor Detail |
|---|
public Simulator(PriorityQueue q)
public Simulator()
| Method Detail |
|---|
public void schedule(Event e)
throws OverflowException
OverflowExceptionpublic void run()
protected void handle(java.lang.Exception e)
e - The exception thrown.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||