fern.network
Interface AmountManager

All Known Implementing Classes:
ConstantAmountManager, DefaultAmountManager

public interface AmountManager

The AmountManager is one of the most important connections between a Network and a Simulator. Each Simulator calls the performReaction method when it fires a reaction. The amount manager then reflects the change of its reactant / product populations. Additionally, the PropensityCalculator uses getAmount to calculate the propensity of a reaction.

It is also possible (and necessary for the tau leaping algorithms) to save the actual amount of each species and, if some error happened, restore these saved values.

The amounts are stored in an array.

Author:
Florian Erhard

Method Summary
 long getAmount(int species)
          Gets the current amount of a species.
 void performReaction(int reaction, int times)
          Reflects a (multiple) firing of a reaction by adjusting the populations of the reactants and the products.
 void resetAmount()
          Resets the amount of each species to the initial amount retrieved by the networks AnnotationManager.
 void rollback()
          Restore the amount array from the recently saved one.
 void save()
          Makes a copy of the amount array.
 void setAmount(int species, long amount)
          Sets the current amount of a species.
 

Method Detail

performReaction

void performReaction(int reaction,
                     int times)
Reflects a (multiple) firing of a reaction by adjusting the populations of the reactants and the products. If a population becomes negative, a RuntimeException is thrown.

Parameters:
reaction - the index of the reaction fired
times - the number of firings

getAmount

long getAmount(int species)
Gets the current amount of a species.

Parameters:
species - index of the species
Returns:
actual amount of the species

setAmount

void setAmount(int species,
               long amount)
Sets the current amount of a species.

Parameters:
species - index of the species

resetAmount

void resetAmount()
Resets the amount of each species to the initial amount retrieved by the networks AnnotationManager. This is called whenever a Simulator is started.


save

void save()
Makes a copy of the amount array.


rollback

void rollback()
Restore the amount array from the recently saved one.