1 /* Copyright (C) 2006-2007  Egon Willighagen <egonw@users.sf.net>
2  *
3  *  Contact: cdk-devel@lists.sourceforge.net
4  *
5  *  This program is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Lesser General Public License
7  *  as published by the Free Software Foundation; either version 2.1
8  *  of the License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Lesser General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Lesser General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 package org.openscience.cdk.interfaces;
20 
21 import java.util.Comparator;
22 
23 /**
24  * A set of AtomContainers.
25  *
26  * @author     egonw
27  * @cdk.module interfaces
28  * @cdk.githash
29  */
30 public interface IAtomContainerSet extends IChemObject {
31 
32     /**
33      * Adds an atomContainer to this container.
34      *
35      * @param  atomContainer  The atomContainer to be added to this container
36      */
addAtomContainer(IAtomContainer atomContainer)37     public void addAtomContainer(IAtomContainer atomContainer);
38 
39     /**
40      * Removes an AtomContainer from this container.
41      *
42      * @param  atomContainer  The atomContainer to be removed from this container
43      */
removeAtomContainer(IAtomContainer atomContainer)44     public void removeAtomContainer(IAtomContainer atomContainer);
45 
46     /**
47      * Removes all AtomContainer from this container.
48      */
removeAllAtomContainers()49     public void removeAllAtomContainers();
50 
51     /**
52      * Removes an AtomContainer from this container.
53      *
54      * @param  pos  The position of the AtomContainer to be removed from this container
55      */
removeAtomContainer(int pos)56     public void removeAtomContainer(int pos);
57 
58     /**
59      * Replace the AtomContainer at a specific position (array has to be large enough).
60      *
61      * @param position   position in array for AtomContainer
62      * @param container  the replacement AtomContainer
63      */
replaceAtomContainer(int position, IAtomContainer container)64     public void replaceAtomContainer(int position, IAtomContainer container);
65 
66     /**
67      * Sets the coefficient of a AtomContainer to a given value.
68      *
69      * @param  container   The AtomContainer for which the multiplier is set
70      * @param  multiplier  The new multiplier for the AtomContatiner
71      * @return             true if multiplier has been set
72      * @see                #getMultiplier(IAtomContainer)
73      */
setMultiplier(IAtomContainer container, Double multiplier)74     public boolean setMultiplier(IAtomContainer container, Double multiplier);
75 
76     /**
77      * Sets the coefficient of a AtomContainer to a given value.
78      *
79      * @param  position    The position of the AtomContainer for which the multiplier is
80      *                    set in [0,..]
81      * @param  multiplier  The new multiplier for the AtomContatiner at
82      *                    <code>position</code>
83      * @see                #getMultiplier(int)
84      */
setMultiplier(int position, Double multiplier)85     public void setMultiplier(int position, Double multiplier);
86 
87     /**
88      * Returns an array of double with the stoichiometric coefficients
89      * of the products.
90      *
91      * @return    The multipliers for the AtomContainer's in this set
92      * @see       #setMultipliers
93      */
getMultipliers()94     public Double[] getMultipliers();
95 
96     /**
97      * Sets the multipliers of the AtomContainers.
98      *
99      * @param  newMultipliers  The new multipliers for the AtomContainers in this set
100      * @return                 true if multipliers have been set.
101      * @see                    #getMultipliers
102      */
setMultipliers(Double[] newMultipliers)103     public boolean setMultipliers(Double[] newMultipliers);
104 
105     /**
106      * Adds an atomContainer to this container with the given
107      * multiplier.
108      *
109      * @param  atomContainer  The atomContainer to be added to this container
110      * @param  multiplier     The multiplier of this atomContainer
111      */
addAtomContainer(IAtomContainer atomContainer, double multiplier)112     public void addAtomContainer(IAtomContainer atomContainer, double multiplier);
113 
114     /**
115      * Adds all atomContainers in the AtomContainerSet to this container.
116      *
117      * @param  atomContainerSet  The AtomContainerSet
118      */
add(IAtomContainerSet atomContainerSet)119     public void add(IAtomContainerSet atomContainerSet);
120 
121     /**
122      *  Get an Iterable for this AtomContainerSet.
123      *
124      * @return A new Iterable for this AtomContainerSet.
125      */
atomContainers()126     public Iterable<IAtomContainer> atomContainers();
127 
128     /**
129      * Returns the AtomContainer at position <code>number</code> in the
130      * container.
131      *
132      * @param  number  The position of the AtomContainer to be returned.
133      * @return         The AtomContainer at position <code>number</code> .
134      */
getAtomContainer(int number)135     public IAtomContainer getAtomContainer(int number);
136 
137     /**
138      * Returns the multiplier for the AtomContainer at position <code>number</code> in the
139      * container.
140      *
141      * @param  number  The position of the multiplier of the AtomContainer to be returned.
142      * @return         The multiplier for the AtomContainer at position <code>number</code> .
143      * @see            #setMultiplier(int, Double)
144      */
getMultiplier(int number)145     public Double getMultiplier(int number);
146 
147     /**
148      * Returns the multiplier of the given AtomContainer.
149      *
150      * @param  container  The AtomContainer for which the multiplier is given
151      * @return            -1, if the given molecule is not a container in this set
152      * @see               #setMultiplier(IAtomContainer, Double)
153      */
getMultiplier(IAtomContainer container)154     public Double getMultiplier(IAtomContainer container);
155 
156     /**
157      * Returns the number of AtomContainers in this Container.
158      *
159      * @return    The number of AtomContainers in this Container
160      */
getAtomContainerCount()161     public int getAtomContainerCount();
162 
163     /**
164       * Sort the AtomContainers using a provided Comparator.
165       *
166       * @param comparator defines the sorting method
167       */
sortAtomContainers(Comparator<IAtomContainer> comparator)168     public void sortAtomContainers(Comparator<IAtomContainer> comparator);
169 
170     /**
171      * Returns true if this IAtomContainerSet is empty.
172      *
173      * @return a boolean indicating if this ring set no atom containers
174      */
isEmpty()175     public boolean isEmpty();
176 }
177