25package umontreal.ssj.simevents;
27import umontreal.ssj.simevents.eventlist.EventList;
28import umontreal.ssj.simevents.eventlist.SplayTree;
53 protected double currentTime = 0.0;
60 protected boolean stopped =
true;
64 protected boolean simulating =
false;
88 if (eventList ==
null)
89 throw new NullPointerException();
90 this.eventList = eventList;
131 throw new NullPointerException();
171 Event ev = eventList.removeFirst();
174 currentTime = ev.eventTime;
175 ev.eventTime = -10.0;
184 if (eventList.isEmpty())
185 throw new IllegalStateException(
"start() called with an empty event list");
225 if (continuousState ==
null)
227 return continuousState;
Represents the portion of the simulator’s state associated with continuous-time simulation.
This abstract class provides event scheduling tools.
abstract void actions()
This is the method that is executed when this event occurs.
Event removeFirstEvent()
Removes the first event from the event list and sets the simulation clock to its event time.
void init(EventList evlist)
Same as init, but also sets evlist as the event list to be used.
EventList getEventList()
Gets the currently used event list.
void stop()
Tells the simulation executive to stop as soon as it takes control, and to return control to the prog...
ContinuousState continuousState()
Returns the current state of continuous variables being integrated during the simulation.
void start()
Starts the simulation executive.
void init()
Reinitializes the simulation executive by clearing up the event list, and resetting the simulation cl...
Simulator()
Constructs a new simulator using a splay tree for the event list.
boolean isSimulating()
Determines if this simulator is currently running, i.e., executing scheduled events.
static Simulator defaultSimulator
Represents the default simulator being used by the class Sim, and the no-argument constructor of Even...
static Simulator getDefaultSimulator()
Returns the default simulator instance used by the deprecated class.
double time()
Returns the current value of the simulation clock.
boolean isStopped()
Determines if this simulator was stopped by an event.
Simulator(EventList eventList)
Constructs a new simulator using eventList for the event list.
An implementation of EventList using a splay tree.
An interface for implementations of event lists.