public abstract class IntervalObserver extends Observer implements GnuPlotObserver
step
: check after each step if a interval range has been passed
theta
: register thetas for the interval ranges
The type of the used method can be set by using setThetaMethod(boolean)
.
Extending classes just have to implement getEntityValue(int)
and to
pass some indices and names to to constructor.
Constructor and Description |
---|
IntervalObserver(Simulator sim,
double interval,
int duration,
String[] entityName) |
IntervalObserver(Simulator sim,
double interval,
String[] entityName)
Create the observer for a given simulator, a given interval, given indices with names.
|
Modifier and Type | Method and Description |
---|---|
void |
activateReaction(int mu,
double tau,
Simulator.FireType fireType,
int times)
Do nothing.
|
void |
finished()
Adds the recorded data to the average data pool.
|
double[][] |
getAvgLog() |
double |
getFinalValue(int entityIndex)
Gets the last value of the given entity.
|
double[][] |
getRecentData()
Gets the recorded data of the most recent simulation run.
|
boolean |
isPlotQuality()
Gets whether or not to plot quality data.
|
boolean |
isThetaMethod()
Using theta method means that the time intervals are registered at the simulator and the
simulator invokes at this moment the method theta.
|
void |
setPlotQuality(boolean plotQuality)
Sets whether or not to plot quality data.
|
void |
setThetaMethod(boolean thetaMethod)
Using theta method means that the time intervals are registered at the simulator and the
simulator invokes at this moment the method theta.
|
void |
started()
Clears the recorded values and registers (if needed)
theta |
void |
step()
If the
step method is used, the data is recorded here. |
void |
theta(double theta)
If the
theta method is used, the data is recorded here. |
GnuPlot |
toGnuplot()
Creates a new
GnuPlot object and passes the actual observer data to it. |
GnuPlot |
toGnuplot(GnuPlot gnuplot)
Passes the actual observer data to a
GnuPlot object. |
GnuPlot |
toGnuplotRecent()
Creates a new
GnuPlot object and passes the recent observer data to it. |
GnuPlot |
toGnuplotRecent(GnuPlot gnuplot)
Passes the recent observer data to a
GnuPlot object. |
String |
toString() |
getLabelFormat, getNumSimulations, getPrintWriter, getSimulator, getTheta, print, setLabelFormat, setPrintWriter, setTheta
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getStyles
public IntervalObserver(Simulator sim, double interval, String[] entityName)
sim
- simulatorinterval
- intervalentityName
- names of the entitiespublic void started()
theta
public void activateReaction(int mu, double tau, Simulator.FireType fireType, int times)
activateReaction
in class Observer
mu
- the reaction which is supposed to firetau
- the time the reaction fires (at this time Simulator.getTime()
does not
necessarily yield the firing time)fireType
- the type of the firingtimes
- TODOpublic void finished()
public void step()
step
method is used, the data is recorded here.public void theta(double theta)
theta
method is used, the data is recorded here.public boolean isThetaMethod()
public void setThetaMethod(boolean thetaMethod)
thetaMethod
- the thetaMethod to setpublic GnuPlot toGnuplot() throws IOException
GnuPlotObserver
GnuPlot
object and passes the actual observer data to it.toGnuplot
in interface GnuPlotObserver
GnuPlot
objectIOException
- if gnuplot could not be accessedpublic GnuPlot toGnuplot(GnuPlot gnuplot) throws IOException
GnuPlotObserver
GnuPlot
object.toGnuplot
in interface GnuPlotObserver
gnuplot
- the GnuPlot
object to pass the data toGnuPlot
objectIOException
- if gnuplot could not be accessedpublic double[][] getRecentData()
public GnuPlot toGnuplotRecent() throws IOException
GnuPlot
object and passes the recent observer data to it. Recent means
that not the average data is used but only the recently produced.GnuPlot
objectIOException
- if gnuplot could not be accessedpublic GnuPlot toGnuplotRecent(GnuPlot gnuplot) throws IOException
GnuPlot
object. Recent means that not the average
data is used but only the recently produced.gnuplot
- the GnuPlot
object to pass the data toGnuPlot
objectIOException
- if gnuplot could not be accessedpublic void setPlotQuality(boolean plotQuality)
toGnuplot
adds
not only the values but also one column in which the number of experiments (from how many
values is the average of the regarding row calculated) isplotQuality
- whether or not to plot qualitiespublic boolean isPlotQuality()
toGnuplot
adds
not only the values but also one column in which the number of experiments (from how many
values is the average of the regarding row calculated) ispublic double getFinalValue(int entityIndex)
entityIndex
- index of the entitypublic double[][] getAvgLog()
Copyright © 2007–2021. All rights reserved.