fern.simulation.observer
Class LeapObserver

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

public class LeapObserver
extends Observer
implements GnuPlotObserver

Observes the amount of given molecule species at each step. It particularly makes sense for the approximative leaping algorithms whose steps are precisely the leaps and you want to know about amount differences after each leap.

This observer does not take repeats into account. If you repeat the simulation, you will just get the results of the recent run.

Author:
Florian Erhard

Constructor Summary
LeapObserver(Simulator sim, String... speciesNames)
          Creates the observer with a given simulator and given species
 
Method Summary
 void activateReaction(int mu, double tau, Simulator.FireType fireType, int times)
          Do nothing.
 void finished()
          Do nothing.
 int getNumLeaps()
          Gets the number of the performed leaps
 String[] getStyles()
          Gets the styles for the columns.
 void started()
          Clears the recorded data.
 void step()
          Record the time and amounts of the species.
 void theta(double theta)
          Do nothing.
 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.
 String 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

LeapObserver

public LeapObserver(Simulator sim,
                    String... speciesNames)
Creates the observer with a given simulator and given species

Parameters:
sim - simulator
speciesNames - names of the species
Method Detail

activateReaction

public void activateReaction(int mu,
                             double tau,
                             Simulator.FireType fireType,
                             int times)
Do nothing.

Specified by:
activateReaction in class Observer
Parameters:
mu - the reaction which is supposed to fire
tau - 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

finished

public void finished()
Do nothing.

Specified by:
finished in class Observer

started

public void started()
Clears the recorded data.

Specified by:
started in class Observer

step

public void step()
Record the time and amounts of the species.

Specified by:
step in class Observer

theta

public void theta(double theta)
Do nothing.

Specified by:
theta in class Observer
Parameters:
theta - moment in time

toGnuplot

public GnuPlot toGnuplot()
                  throws IOException
Description copied from interface: GnuPlotObserver
Creates a new GnuPlot object and passes the actual observer data to it.

Specified by:
toGnuplot in interface GnuPlotObserver
Returns:
the created GnuPlot object
Throws:
IOException - if gnuplot could not be accessed

toGnuplot

public GnuPlot toGnuplot(GnuPlot gnuplot)
                  throws IOException
Description copied from interface: GnuPlotObserver
Passes the actual observer data to a GnuPlot object.

Specified by:
toGnuplot in interface GnuPlotObserver
Parameters:
gnuplot - the GnuPlot object to pass the data to
Returns:
the GnuPlot object
Throws:
IOException - if gnuplot could not be accessed

getNumLeaps

public int getNumLeaps()
Gets the number of the performed leaps

Returns:
number of leaps.

getStyles

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

Specified by:
getStyles in interface GnuPlotObserver
Returns:
styles for the columns

toString

public String toString()
Overrides:
toString in class Object