Package it.unibo.alchemist.model.actions
Class ToggleMoleculeRandomly
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.Action
,java.io.Serializable
public class ToggleMoleculeRandomly<T extends Object> extends ToggleMolecule<T>
Treats molecule as a probabilistic switch:
if it is present, then with probability odds it's removed from node;
otherwise, with probability odds it is inserted in node with the provided concentration.
-
-
Method Summary
Modifier and Type Method Description ToggleMoleculeRandomly<T>
cloneAction(Node<T> node, Reaction<T> reaction)
Unit
execute()
Rolls the dice and toggles the molecule. -
Methods inherited from class it.unibo.alchemist.model.actions.ToggleMolecule
getContext
-
Methods inherited from class it.unibo.alchemist.model.actions.AbstractAction
getOutboundDependencies, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ToggleMoleculeRandomly
ToggleMoleculeRandomly(Node<T> node, RandomGenerator randomGenerator, Molecule molecule, T concentration, Double odds)
- Parameters:
node
- the node containing the molecule to togglerandomGenerator
- random number generator to usemolecule
- the molecule to toggleconcentration
- the concentration to use for the "on" stateodds
- probability to toggle the molecule every time the action is triggered
-
-
Method Detail
-
cloneAction
ToggleMoleculeRandomly<T> cloneAction(Node<T> node, Reaction<T> reaction)
-
-
-
-