-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Comparable
public interface Reaction<T> implements Comparable<Reaction<T>>, Serializable
-
-
Method Summary
Modifier and Type Method Description abstract booleancanExecute()abstract Reaction<T>cloneOnNewNode(Node<T> node, Time currentTime)This method allows to clone this reaction on a new node. abstract voidexecute()Executes the reactions. abstract voidinitializationComplete(Time atTime, Environment<T, out Object> environment)This method is called when the environment has completed its initialization. abstract List<Action<T>>getActions()abstract List<Condition<T>>getConditions()abstract ListSet<out Dependency>getOutboundDependencies()abstract ListSet<out Dependency>getInboundDependencies()abstract ContextgetInputContext()abstract Node<T>getNode()abstract ContextgetOutputContext()abstract doublegetRate()Returns the speed of this Reaction. abstract TimegetTau()abstract TimeDistribution<T>getTimeDistribution()abstract voidsetActions(List<Action<T>> actions)Sets the Actions list. abstract voidsetConditions(List<Condition<T>> conditions)Sets the Conditions list. abstract voidupdate(Time currentTime, boolean hasBeenExecuted, Environment<T, out Object> environment)Updates the scheduling of this reaction. -
-
Method Detail
-
canExecute
abstract boolean canExecute()
-
cloneOnNewNode
abstract Reaction<T> cloneOnNewNode(Node<T> node, Time currentTime)
This method allows to clone this reaction on a new node. It may result useful to support runtime creation of nodes with the same reaction programming, e.g. for morphogenesis.
- Parameters:
node- The node where to clone this ReactioncurrentTime- the time at which the clone is created (required to correctly clone the TimeDistributions)
-
execute
abstract void execute()
Executes the reactions.
-
initializationComplete
abstract void initializationComplete(Time atTime, Environment<T, out Object> environment)
This method is called when the environment has completed its initialization. Can be used by this reaction to compute its next execution time - in case such computation requires an inspection of the environment.
- Parameters:
atTime- the time at which the initialization of this reaction was accomplishedenvironment- the environment
-
getActions
abstract List<Action<T>> getActions()
-
getConditions
abstract List<Condition<T>> getConditions()
-
getOutboundDependencies
abstract ListSet<out Dependency> getOutboundDependencies()
-
getInboundDependencies
abstract ListSet<out Dependency> getInboundDependencies()
-
getInputContext
abstract Context getInputContext()
-
getOutputContext
abstract Context getOutputContext()
-
getRate
abstract double getRate()
Returns the speed of this Reaction. It is an average number, and can potentially change during the simulation, depending on the implementation.
-
getTimeDistribution
abstract TimeDistribution<T> getTimeDistribution()
-
setActions
abstract void setActions(List<Action<T>> actions)
Sets the Actions list. Some implementations may not allow to change it at runtime.
- Parameters:
actions- the list of actions for this reaction
-
setConditions
abstract void setConditions(List<Condition<T>> conditions)
Sets the Conditions list. Some implementations may not allow to change it at runtime.
- Parameters:
conditions- the list of conditions for this action
-
update
abstract void update(Time currentTime, boolean hasBeenExecuted, Environment<T, out Object> environment)
Updates the scheduling of this reaction.
- Parameters:
currentTime- the current Time of execution.hasBeenExecuted- true if the reaction have just been executed.environment- the current environment
-
-
-
-