hSimulator.library
Class ReactionPartition

java.lang.Object
  extended by hSimulator.library.ReactionPartition

public class ReactionPartition
extends Object

This object implements an optimized data structure for storing reaction partitioning during hybrid simulations.

Version:
1.0
Author:
Luca Marchetti

Constructor Summary
ReactionPartition(int nReact)
          Creates a new data structure.
 
Method Summary
 void addFastReaction(int i)
          Classifies the i-th reaction as fast.
 void addSlowReaction(int i)
          Classifies the i-th reaction as slow.
 void clear()
          Clears the data structure.
 int getFastReaction(int i)
          Returns the index of the i-th reaction classified as fast.
 int getFastReactionNumber()
          Returns the total number of reactions classified as fast.
 int getSlowReaction(int i)
          Returns the index of the i-th reaction classified as slow.
 int getSlowReactionNumber()
          Returns the total number of reactions classified as slow.
 boolean isFastReaction(int i)
          Checks if the i-th reaction has been classified as fast.
 boolean isSlowReaction(int i)
          Checks if the i-th reaction has been classified as slow.
 boolean isUnknownReaction(int i)
          Checks if the i-th reaction is of unknown type.
 int removeFastReaction(int i)
          Classifies the i-th fast reaction as a reaction of unknown type.
 int removeSlowReaction(int i)
          Classifies the i-th slow reaction as a reaction of unknown type.
 void switchReaction(int i)
          Switches the classification of the i-th reaction (fast to slow or viceversa).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReactionPartition

public ReactionPartition(int nReact)
Creates a new data structure.

Parameters:
nReact - total number of modeled reactions
Method Detail

clear

public void clear()
Clears the data structure.


addFastReaction

public void addFastReaction(int i)
Classifies the i-th reaction as fast.

Parameters:
i - index of the reaction

getFastReactionNumber

public int getFastReactionNumber()
Returns the total number of reactions classified as fast.

Returns:
the number of fast reactions

getFastReaction

public int getFastReaction(int i)
Returns the index of the i-th reaction classified as fast.

Parameters:
i - the index of the required reaction
Returns:
the index of the i-th fast reaction in the total list of modeled reactions (-1 in case of error)

removeFastReaction

public int removeFastReaction(int i)
Classifies the i-th fast reaction as a reaction of unknown type.

Parameters:
i - index of the fast reaction
Returns:
the index of the removed reaction in the total list of reactions

isFastReaction

public boolean isFastReaction(int i)
Checks if the i-th reaction has been classified as fast.

Parameters:
i - the index of the reaction to check
Returns:
a boolean indicating if the i-th reaction is fast

addSlowReaction

public void addSlowReaction(int i)
Classifies the i-th reaction as slow.

Parameters:
i - index of the reaction

getSlowReactionNumber

public int getSlowReactionNumber()
Returns the total number of reactions classified as slow.

Returns:
the number of fast reactions

getSlowReaction

public int getSlowReaction(int i)
Returns the index of the i-th reaction classified as slow.

Parameters:
i - the index of the required reaction
Returns:
the index of the i-th slow reaction in the total list of modeled reactions (-1 in case of error)

removeSlowReaction

public int removeSlowReaction(int i)
Classifies the i-th slow reaction as a reaction of unknown type.

Parameters:
i - index of the slow reaction
Returns:
the index of the removed reaction in the total list of reactions

isSlowReaction

public boolean isSlowReaction(int i)
Checks if the i-th reaction has been classified as slow.

Parameters:
i - the index of the reaction to check
Returns:
a boolean indicating if the i-th reaction is slow

isUnknownReaction

public boolean isUnknownReaction(int i)
Checks if the i-th reaction is of unknown type.

Parameters:
i - the index of the reaction to check
Returns:
a boolean indicating if the i-th reaction is of unknown type

switchReaction

public void switchReaction(int i)
Switches the classification of the i-th reaction (fast to slow or viceversa).

Parameters:
i - the index of the reaction to switch