public abstract class Observer extends Object implements Comparable<Observer>
toString method which should return a string representation of its data.
You can register a PrintWriter to the
Observer. If you have, the return value of
toString is printed if a simulation has finished.
| Modifier and Type | Field and Description |
|---|---|
private StochasticSimulator |
process |
| Constructor and Description |
|---|
Observer(StochasticSimulator sim)
Creates an observer dedicated to one process.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Observer o) |
abstract void |
finished()
Gets called when a simulation has finished, directly after the termination check.
|
abstract void |
observeEvent(SimulationEvent event,
double tau,
int times)
Gets called before an event is triggered.
|
abstract void |
started()
Gets called when the simulation has started after the initialization and before the termination condition is
checked the first time.
|
abstract void |
step()
Gets called after each termination check and before
Simulator#performStep(fern.simulation.controller.SimulationController) is called. |
abstract void |
theta(double thetaTime,
Collection<Object> events)
Gets called by simulators when a certain moment in time is reached.
|
private StochasticSimulator process
public Observer(StochasticSimulator sim)
Simulator#addObserver(Observer) in order to do this.
sim - the processpublic final int compareTo(Observer o)
compareTo in interface Comparable<Observer>public abstract void started()
public abstract void step()
Simulator#performStep(fern.simulation.controller.SimulationController) is called.public abstract void finished()
public abstract void theta(double thetaTime,
Collection<Object> events)
thetaTime - moment in timeevents - a collection of events that occur at thetaTime.public abstract void observeEvent(SimulationEvent event, double tau, int times)
event - the event which is supposed to firetau - the time the event occurs (at this time Simulator#getTime()times - the number of firingsCopyright © 2015 University of Glasgow. All rights reserved.