fern.simulation.observer
Class RandomNumberGeneratorCallObserver

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

public class RandomNumberGeneratorCallObserver
extends Observer
implements GnuPlotObserver

Observes the calls to the random number generator and count the number of drawn random number of different distributions. These calls are crucial for the stochastic algorithms because besides algebraic calculations are these the most time consuming operations.

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

Author:
Florian Erhard
See Also:
Stochastics

Constructor Summary
RandomNumberGeneratorCallObserver(Simulator sim)
          Creates the observer for the given simulator.
 
Method Summary
 void activateReaction(int mu, double tau, Simulator.FireType fireType, int times)
          Do nothing.
 void finished()
          Calculates the average.
 String[] getStyles()
          Gets the styles for the columns.
 void started()
          Resets the count variables of the random number generator calls.
 void step()
          Do nothing.
 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

RandomNumberGeneratorCallObserver

public RandomNumberGeneratorCallObserver(Simulator sim)
Creates the observer for the given simulator.

Parameters:
sim - simulator
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()
Calculates the average.

Specified by:
finished in class Observer

started

public void started()
Resets the count variables of the random number generator calls.

Specified by:
started in class Observer
See Also:
Stochastics.resetCounts()

step

public void step()
Do nothing.

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

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

toGnuplot

public GnuPlot toGnuplot()
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

toGnuplot

public GnuPlot toGnuplot(GnuPlot gnuplot)
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

toString

public String toString()
Overrides:
toString in class Object