fern.simulation.observer
Class ReactionIntervalObserver

java.lang.Object
  extended by fern.simulation.observer.Observer
      extended by fern.simulation.observer.IntervalObserver
          extended by fern.simulation.observer.ReactionIntervalObserver
All Implemented Interfaces:
GnuPlotObserver

public class ReactionIntervalObserver
extends IntervalObserver

Observes number of firings of reactions repeatedly after certain intervals.

This observer does take repeats into account. If you repeat the simulation, you will get an average over the results of each run.

Author:
Florian Erhard

Constructor Summary
ReactionIntervalObserver(Simulator sim, double interval, int... reactions)
          Creates the observer for a given simulator, a given interval and given reaction indices.
ReactionIntervalObserver(Simulator sim, double interval, String... speciesNames)
          Creates the observer for a given simulator, a given interval and given neighbors.
 
Method Summary
 void activateReaction(int mu, double t, Simulator.FireType fireType, int times)
          Record the firing of mu, if mu is registered.
 double getRecordStart()
          Gets the moment in time where the recording starts
 String[] getStyles()
          Gets the styles for the columns.
 void setRecordStart(double recordStart)
          Sets the moment in time where the recording starts
 void started()
          Clears the recorded values and registers (if needed) theta
 
Methods inherited from class fern.simulation.observer.IntervalObserver
finished, getFinalValue, getRecentData, isPlotQuality, isThetaMethod, setPlotQuality, setThetaMethod, step, theta, toGnuplot, toGnuplot, toGnuplotRecent, toGnuplotRecent, toString
 
Methods inherited from class fern.simulation.observer.Observer
getLabelFormat, getNumSimulations, getPrintWriter, getSimulator, getTheta, print, setLabelFormat, setPrintWriter, setTheta
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReactionIntervalObserver

public ReactionIntervalObserver(Simulator sim,
                                double interval,
                                String... speciesNames)
Creates the observer for a given simulator, a given interval and given neighbors.

Parameters:
sim - simulator
interval - interval
speciesNames - the names of the species, each neighboring reaction of any of these is added

ReactionIntervalObserver

public ReactionIntervalObserver(Simulator sim,
                                double interval,
                                int... reactions)
Creates the observer for a given simulator, a given interval and given reaction indices.

Parameters:
sim - simulator
interval - interval
reactions - reaction indices
Method Detail

activateReaction

public void activateReaction(int mu,
                             double t,
                             Simulator.FireType fireType,
                             int times)
Record the firing of mu, if mu is registered.

Overrides:
activateReaction in class IntervalObserver
Parameters:
mu - the reaction which is supposed to fire
t - the time the reaction fires (at this time Simulator.getTime() does not necessarily yield the firing time)
fireType - the type of the firing
times - TODO

started

public void started()
Description copied from class: IntervalObserver
Clears the recorded values and registers (if needed) theta

Overrides:
started in class IntervalObserver

getRecordStart

public double getRecordStart()
Gets the moment in time where the recording starts

Returns:
the recordStart

setRecordStart

public void setRecordStart(double recordStart)
Sets the moment in time where the recording starts

Parameters:
recordStart - the recordStart to set

getStyles

public String[] getStyles()
Description copied from interface: GnuPlotObserver
Gets the styles for the columns. If you don't want styles, just return null!

Returns:
styles for the columns