Interface Node
-
- All Implemented Interfaces:
-
java.io.Serializable
,kotlin.Comparable
,kotlin.collections.Iterable
public interface Node<T extends Object> implements Serializable, Iterable<Reaction<T>>, Comparable<Node<T>>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
Node.Companion
Utilities for Nodes.
-
Method Summary
Modifier and Type Method Description abstract Unit
addReaction(Reaction<T> reactionToAdd)
Adds a reaction to this node. abstract Node<T>
cloneNode(Time currentTime)
Creates a new Node which is a clone of the current Node. abstract Boolean
contains(Molecule molecule)
Tests whether a node contains a Molecule. abstract T
getConcentration(Molecule molecule)
Calculates the concentration of a molecule. abstract Integer
hashCode()
abstract Boolean
equals(Object other)
abstract Unit
removeConcentration(Molecule moleculeToRemove)
abstract Unit
removeReaction(Reaction<T> reactionToRemove)
Removes a reaction from this node. abstract Unit
setConcentration(Molecule molecule, T concentration)
Sets the concentration of mol to c. abstract Unit
addProperty(NodeProperty<T> nodeProperty)
Adds a capability to the node. <C extends NodeProperty<T>> C
asPropertyOrNull(Class<in C> superType)
returns a NodeProperty of the provided superType. <C extends NodeProperty<T>> C
asPropertyOrNull(KClass<in C> superType)
returns a NodeProperty of the provided superType. <C extends NodeProperty<T>> C
asProperty(KClass<C> superType)
returns a NodeProperty of the provided superType. <C extends NodeProperty<T>> C
asProperty(Class<C> superType)
returns a NodeProperty of the provided superType. abstract Map<Molecule, T>
getContents()
abstract Integer
getId()
abstract Integer
getMoleculeCount()
abstract List<NodeProperty<T>>
getProperties()
abstract List<Reaction<T>>
getReactions()
This method allows to access all the reaction of the node. -
-
Method Detail
-
addReaction
abstract Unit addReaction(Reaction<T> reactionToAdd)
Adds a reaction to this node. The reaction is added only in the node, but not in the it.unibo.alchemist.core.Simulation scheduler, so it will never be executed. To add the reaction also in the scheduler (and start to execute it), you have to call also the method it.unibo.alchemist.core.Simulation.reactionAdded.
- Parameters:
reactionToAdd
- the reaction to be added
-
cloneNode
abstract Node<T> cloneNode(Time currentTime)
Creates a new Node which is a clone of the current Node. The new Node will have all the current Node's properties, such as reactions and molecules, but it will also have a different ID.
- Parameters:
currentTime
- the time at which the cloning operation happens- Returns:
A new Node which is a clone of the current one.
-
contains
abstract Boolean contains(Molecule molecule)
Tests whether a node contains a Molecule.
- Parameters:
molecule
- the molecule to check- Returns:
true if the molecule is present, false otherwise
-
getConcentration
abstract T getConcentration(Molecule molecule)
Calculates the concentration of a molecule.
- Parameters:
molecule
- the molecule whose concentration will be returned- Returns:
the concentration of the molecule
-
removeConcentration
abstract Unit removeConcentration(Molecule moleculeToRemove)
- Parameters:
moleculeToRemove
- the molecule that should be removed
-
removeReaction
abstract Unit removeReaction(Reaction<T> reactionToRemove)
Removes a reaction from this node. The reaction is removed only in the node, but not in the it.unibo.alchemist.core.Simulation scheduler, so the scheduler will continue to execute the reaction. To remove the reaction also in the scheduler (and stop to execute it), you have to call also the method it.unibo.alchemist.core.Simulation.reactionRemoved.
- Parameters:
reactionToRemove
- the reaction to be removed
-
setConcentration
abstract Unit setConcentration(Molecule molecule, T concentration)
Sets the concentration of mol to c.
- Parameters:
molecule
- the molecule you want to set the concentrationconcentration
- the concentration you want for mol
-
addProperty
abstract Unit addProperty(NodeProperty<T> nodeProperty)
Adds a capability to the node.
- Parameters:
nodeProperty
- the capability you want to add to the node
-
asPropertyOrNull
<C extends NodeProperty<T>> C asPropertyOrNull(Class<in C> superType)
returns a NodeProperty of the provided superType.
- Parameters:
superType
- the type of capability to retrieve- Returns:
a capability of the provided type C
-
asPropertyOrNull
<C extends NodeProperty<T>> C asPropertyOrNull(KClass<in C> superType)
returns a NodeProperty of the provided superType.
- Parameters:
superType
- the type of capability to retrieve- Returns:
a capability of the provided type C
-
asProperty
<C extends NodeProperty<T>> C asProperty(KClass<C> superType)
returns a NodeProperty of the provided superType.
- Parameters:
superType
- the type of capability to retrieve- Returns:
a capability of the provided type C
-
asProperty
<C extends NodeProperty<T>> C asProperty(Class<C> superType)
returns a NodeProperty of the provided superType.
- Parameters:
superType
- the type of capability to retrieve- Returns:
a capability of the provided type C
-
getContents
abstract Map<Molecule, T> getContents()
- Returns:
the molecule corresponding to the i-th position
-
getMoleculeCount
abstract Integer getMoleculeCount()
- Returns:
the count of different molecules in this node
-
getProperties
abstract List<NodeProperty<T>> getProperties()
- Returns:
a list of the node's properties/capabilities
-
getReactions
abstract List<Reaction<T>> getReactions()
This method allows to access all the reaction of the node.
- Returns:
the list of rections belonging to this node
-
-
-
-