Package org.openscience.cdk.silent
Class ReactionSet
- java.lang.Object
-
- org.openscience.cdk.silent.ChemObject
-
- org.openscience.cdk.silent.ReactionSet
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ICDKObject
,IChemObject
,IChemObjectListener
,IReactionSet
- Direct Known Subclasses:
ReactionScheme
public class ReactionSet extends ChemObject implements Serializable, IReactionSet, IChemObjectListener, Cloneable
A set of reactions, for example those taking part in a reaction. To retrieve the reactions from the set, there are two options:Iterator reactions = reactionSet.reactions(); while (reactions.hasNext()) { IReaction reaction = (IReaction)reactions.next(); }
andfor (int i=0; i < reactionSet.getReactionCount(); i++) { IReaction reaction = reactionSet.getReaction(i); }
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- silent
- Keywords:
- reaction
-
-
Constructor Summary
Constructors Constructor Description ReactionSet()
Constructs an empty ReactionSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReaction(IReaction reaction)
Adds an reaction to this container.Object
clone()
Clones thisReactionSet
and the containedReaction
s too.IReaction
getReaction(int number)
Returns the Reaction at positionnumber
in the container.int
getReactionCount()
Returns the number of Reactions in this Container.boolean
isEmpty()
Returns true if this IReactionSet is empty.Iterable<IReaction>
reactions()
Get an iterator for this reaction set.void
removeAllReactions()
Removes all Reactions from this container.void
removeReaction(int pos)
Remove a reaction from this set.void
removeReaction(IReaction relevantReaction)
Removes all instances of a reaction from this IReactionSet.void
stateChanged(IChemObjectChangeEvent event)
Called by objects to notify objects that implemented this interface and registered with them as ChemObjectListeners.String
toString()
Returns a one line description of this IChemObject.-
Methods inherited from class org.openscience.cdk.silent.ChemObject
addListener, addProperties, compare, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty, shallowCopy
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openscience.cdk.interfaces.ICDKObject
getBuilder
-
Methods inherited from interface org.openscience.cdk.interfaces.IChemObject
addListener, addProperties, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty
-
-
-
-
Method Detail
-
addReaction
public void addReaction(IReaction reaction)
Adds an reaction to this container.- Specified by:
addReaction
in interfaceIReactionSet
- Parameters:
reaction
- The reaction to be added to this container
-
removeReaction
public void removeReaction(int pos)
Remove a reaction from this set.- Specified by:
removeReaction
in interfaceIReactionSet
- Parameters:
pos
- The position of the reaction to be removed.
-
getReaction
public IReaction getReaction(int number)
Returns the Reaction at positionnumber
in the container.- Specified by:
getReaction
in interfaceIReactionSet
- Parameters:
number
- The position of the Reaction to be returned- Returns:
- The Reaction at position
number
-
reactions
public Iterable<IReaction> reactions()
Get an iterator for this reaction set.- Specified by:
reactions
in interfaceIReactionSet
- Returns:
- A new Iterator for this ReactionSet.
-
getReactionCount
public int getReactionCount()
Returns the number of Reactions in this Container.- Specified by:
getReactionCount
in interfaceIReactionSet
- Returns:
- The number of Reactions in this Container
-
toString
public String toString()
Description copied from interface:IChemObject
Returns a one line description of this IChemObject.- Specified by:
toString
in interfaceIChemObject
- Overrides:
toString
in classObject
- Returns:
- a String representation of this object
-
clone
public Object clone() throws CloneNotSupportedException
Clones thisReactionSet
and the containedReaction
s too.- Specified by:
clone
in interfaceIChemObject
- Overrides:
clone
in classChemObject
- Returns:
- The cloned ReactionSet
- Throws:
CloneNotSupportedException
- if the IChemObject cannot be cloned
-
removeAllReactions
public void removeAllReactions()
Removes all Reactions from this container.- Specified by:
removeAllReactions
in interfaceIReactionSet
-
stateChanged
public void stateChanged(IChemObjectChangeEvent event)
Description copied from interface:IChemObjectListener
Called by objects to notify objects that implemented this interface and registered with them as ChemObjectListeners.- Specified by:
stateChanged
in interfaceIChemObjectListener
- Parameters:
event
- a ChemObjectChangeEvent object
-
removeReaction
public void removeReaction(IReaction relevantReaction)
Description copied from interface:IReactionSet
Removes all instances of a reaction from this IReactionSet.- Specified by:
removeReaction
in interfaceIReactionSet
- Parameters:
relevantReaction
- the reaction to remove
-
isEmpty
public boolean isEmpty()
Returns true if this IReactionSet is empty.- Specified by:
isEmpty
in interfaceIReactionSet
- Returns:
- a boolean indicating if this ring set no reactions
-
-