-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.interfaces.Reaction,java.io.Serializable,java.lang.Comparable
public abstract class AbstractReaction<T> implements Reaction<T>
The type which describes the concentration of a molecule This class offers a partial implementation of Reaction. In particular, it allows to write new reaction specifying only which distribution time to adopt
-
-
Field Summary
Fields Modifier and Type Field Description private List<out Action<T>>actionsprivate List<out Condition<T>>conditionsprivate final TimeDistribution<T>timeDistributionprivate final Node<T>node
-
Constructor Summary
Constructors Constructor Description AbstractReaction(Node<T> node, TimeDistribution<T> timeDistribution)Builds a new reaction, starting at time t.
-
Method Summary
Modifier and Type Method Description voidsetActions(List<Action<T>> actions)This should get overridden only if very tricky behaviours are implemented, such that the default Alchemist action addition model is no longer usable. voidsetConditions(List<Condition<T>> conditions)This should get overridden only if very tricky behaviours are implemented, such that the default Alchemist condition addition model is no longer usable. final TimeDistribution<T>getTimeDistribution()final Node<T>getNode()booleancanExecute()The default implementation verifies if all the conditions are valid. final intcompareTo(Reaction<T> o)final booleanequals(Object o)voidexecute()The default execution iterates all the actions in order and executes them. final ListSet<Dependency>getOutboundDependencies()final ListSet<Dependency>getInboundDependencies()final ContextgetInputContext()final ContextgetOutputContext()final TimegetTau()final inthashCode()voidinitializationComplete(Time atTime, Environment<T, out Object> environment)StringtoString()final voidupdate(Time currentTime, boolean hasBeenExecuted, Environment<T, out Object> environment)-
Methods inherited from class it.unibo.alchemist.model.interfaces.Reaction
cloneOnNewNode, getActions, getConditions, getNode, getRate, getTimeDistribution, setActions, setConditions -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
AbstractReaction
AbstractReaction(Node<T> node, TimeDistribution<T> timeDistribution)
Builds a new reaction, starting at time t.- Parameters:
node- the node this reaction belongs totimeDistribution- the time distribution this reaction should follow
-
-
Method Detail
-
setActions
void setActions(List<Action<T>> actions)
This should get overridden only if very tricky behaviours are implemented, such that the default Alchemist action addition model is no longer usable. Must be overridden along with getActions.
- Parameters:
actions- the actions to set
-
setConditions
void setConditions(List<Condition<T>> conditions)
This should get overridden only if very tricky behaviours are implemented, such that the default Alchemist condition addition model is no longer usable. Must be overridden along with getConditions.
- Parameters:
conditions- the actions to set
-
getTimeDistribution
final TimeDistribution<T> getTimeDistribution()
-
canExecute
boolean canExecute()
The default implementation verifies if all the conditions are valid.
-
execute
void execute()
The default execution iterates all the actions in order and executes them. Override to change the behaviour.
-
getOutboundDependencies
final ListSet<Dependency> getOutboundDependencies()
-
getInboundDependencies
final ListSet<Dependency> getInboundDependencies()
-
getInputContext
final Context getInputContext()
-
getOutputContext
final Context getOutputContext()
-
hashCode
final int hashCode()
-
initializationComplete
void initializationComplete(Time atTime, Environment<T, out Object> environment)
-
update
final void update(Time currentTime, boolean hasBeenExecuted, Environment<T, out Object> environment)
-
-
-
-