001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.7
004 *
005 * Do not make changes to this file unless you know what you are doing--modify
006 * the SWIG interface file instead.
007 * ----------------------------------------------------------------------------- */
008
009package org.sbml.libsbml;
010
011/** 
012 * <span class="pkg-marker pkg-color-fbc"><a href="group__fbc.html">fbc</a></span>
013 A list of {@link GeneProduct} objects.
014 <p>
015 * The {@link ListOfGeneProducts} is a container for the SBML extended {@link Model}
016 * that lists all the possible {@link GeneProduct} elements in the model.  These
017 * {@link GeneProduct} elements are referenced in the {@link GeneProductAssociation} child
018 * of an extended {@link Reaction}.
019 <p>
020 * <p>
021 * @note This class of objects was introduced in Version&nbsp;2 of the
022 * SBML Level&nbsp;3 Flux Balance Constraints (&ldquo;fbc&rdquo;)
023 * specification.  In Version&nbsp;1 of &ldquo;fbc&rdquo;, the information
024 * encoded by this class can be stored instead using the {@link Association} and
025 * {@link GeneAssociation} annotation classes.  Please see the Version&nbsp;1 and
026 * Version&nbsp;2 &ldquo;fbc&rdquo; specifications for more details.
027 <p>
028 * <p>
029 * The various ListOf___ classes in SBML
030 * are merely containers used for organizing the main components of an SBML
031 * model.  In libSBML's implementation, ListOf___
032 * classes are derived from the
033 * intermediate utility class {@link ListOf}, which
034 * is not defined by the SBML specifications but serves as a useful
035 * programmatic construct.  {@link ListOf} is itself is in turn derived from {@link SBase},
036 * which provides all of the various ListOf___
037 * classes with common features
038 * defined by the SBML specification, such as 'metaid' attributes and
039 * annotations.
040 <p>
041 * The relationship between the lists and the rest of an SBML model is
042 * illustrated by the following (for SBML Level&nbsp;2 Version&nbsp;4):
043 <p>
044 * <figure>
045  <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object>
046</figure>
047
048 <p>
049 * Readers may wonder about the motivations for using the ListOf___
050 * containers in SBML.  A simpler approach in XML might be to place the
051 * components all directly at the top level of the model definition.  The
052 * choice made in SBML is to group them within XML elements named after
053 * ListOf<em>Classname</em>, in part because it helps organize the
054 * components.  More importantly, the fact that the container classes are
055 * derived from {@link SBase} means that software tools can add information <em>about</em>
056 * the lists themselves into each list container's 'annotation'.
057 <p>
058 * @see ListOfFunctionDefinitions
059 * @see ListOfUnitDefinitions
060 * @see ListOfCompartmentTypes
061 * @see ListOfSpeciesTypes
062 * @see ListOfCompartments
063 * @see ListOfSpecies
064 * @see ListOfParameters
065 * @see ListOfInitialAssignments
066 * @see ListOfRules
067 * @see ListOfConstraints
068 * @see ListOfReactions
069 * @see ListOfEvents
070 <p>
071 * @see GeneProduct
072 * @see FbcModelPlugin
073 */
074
075public class ListOfGeneProducts extends ListOf {
076   private long swigCPtr;
077
078   protected ListOfGeneProducts(long cPtr, boolean cMemoryOwn)
079   {
080     super(libsbmlJNI.ListOfGeneProducts_SWIGUpcast(cPtr), cMemoryOwn);
081     swigCPtr = cPtr;
082   }
083
084   protected static long getCPtr(ListOfGeneProducts obj)
085   {
086     return (obj == null) ? 0 : obj.swigCPtr;
087   }
088
089   protected static long getCPtrAndDisown (ListOfGeneProducts obj)
090   {
091     long ptr = 0;
092
093     if (obj != null)
094     {
095       ptr             = obj.swigCPtr;
096       obj.swigCMemOwn = false;
097     }
098
099     return ptr;
100   }
101
102  protected void finalize() {
103    delete();
104  }
105
106  public synchronized void delete() {
107    if (swigCPtr != 0) {
108      if (swigCMemOwn) {
109        swigCMemOwn = false;
110        libsbmlJNI.delete_ListOfGeneProducts(swigCPtr);
111      }
112      swigCPtr = 0;
113    }
114    super.delete();
115  }
116
117  
118/**
119   * Creates a new {@link GeneProduct} with the given SBML Level, Version, and
120   * &ldquo;fbc&rdquo;package version.
121   <p>
122   * @param level a long integer, the SBML Level to assign to this
123   * {@link ListOfGeneProducts}
124   <p>
125   * @param version a long integer, the SBML Version to assign to this
126   * {@link ListOfGeneProducts}
127   <p>
128   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
129   * this {@link ListOfGeneProducts}
130   */ public
131 ListOfGeneProducts(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
132    this(libsbmlJNI.new_ListOfGeneProducts__SWIG_0(level, version, pkgVersion), true);
133  }
134
135  
136/**
137   * Creates a new {@link GeneProduct} with the given SBML Level, Version, and
138   * &ldquo;fbc&rdquo;package version.
139   <p>
140   * @param level a long integer, the SBML Level to assign to this
141   * {@link ListOfGeneProducts}
142   <p>
143   * @param version a long integer, the SBML Version to assign to this
144   * {@link ListOfGeneProducts}
145   <p>
146   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
147   * this {@link ListOfGeneProducts}
148   */ public
149 ListOfGeneProducts(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
150    this(libsbmlJNI.new_ListOfGeneProducts__SWIG_1(level, version), true);
151  }
152
153  
154/**
155   * Creates a new {@link GeneProduct} with the given SBML Level, Version, and
156   * &ldquo;fbc&rdquo;package version.
157   <p>
158   * @param level a long integer, the SBML Level to assign to this
159   * {@link ListOfGeneProducts}
160   <p>
161   * @param version a long integer, the SBML Version to assign to this
162   * {@link ListOfGeneProducts}
163   <p>
164   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
165   * this {@link ListOfGeneProducts}
166   */ public
167 ListOfGeneProducts(long level) throws org.sbml.libsbml.SBMLConstructorException {
168    this(libsbmlJNI.new_ListOfGeneProducts__SWIG_2(level), true);
169  }
170
171  
172/**
173   * Creates a new {@link GeneProduct} with the given SBML Level, Version, and
174   * &ldquo;fbc&rdquo;package version.
175   <p>
176   * @param level a long integer, the SBML Level to assign to this
177   * {@link ListOfGeneProducts}
178   <p>
179   * @param version a long integer, the SBML Version to assign to this
180   * {@link ListOfGeneProducts}
181   <p>
182   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
183   * this {@link ListOfGeneProducts}
184   */ public
185 ListOfGeneProducts() throws org.sbml.libsbml.SBMLConstructorException {
186    this(libsbmlJNI.new_ListOfGeneProducts__SWIG_3(), true);
187  }
188
189  
190/**
191   * Creates a new {@link ListOfGeneProducts} with the given {@link FbcPkgNamespaces} object.
192   <p>
193   * @param fbcns the {@link FbcPkgNamespaces} object
194   */ public
195 ListOfGeneProducts(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
196    this(libsbmlJNI.new_ListOfGeneProducts__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
197  }
198
199  
200/**
201   * Creates and returns a deep copy of this {@link ListOfGeneProducts} object.
202   <p>
203   * @return a (deep) copy of this {@link ListOfGeneProducts} object.
204   */ public
205 ListOfGeneProducts cloneObject() {
206    long cPtr = libsbmlJNI.ListOfGeneProducts_cloneObject(swigCPtr, this);
207    return (cPtr == 0) ? null : new ListOfGeneProducts(cPtr, true);
208  }
209
210  
211/**
212   * Get a {@link GeneProduct} from the {@link ListOfGeneProducts}.
213   <p>
214   * @param n the index number of the {@link GeneProduct} to get.
215   <p>
216   * @return the nth {@link GeneProduct} in this {@link ListOfGeneProducts}.
217   <p>
218   * @see #size()
219   */ public
220 GeneProduct get(long n) {
221    long cPtr = libsbmlJNI.ListOfGeneProducts_get__SWIG_0(swigCPtr, this, n);
222    return (cPtr == 0) ? null : new GeneProduct(cPtr, false);
223  }
224
225  
226/**
227   * Get a {@link GeneProduct} from the {@link ListOfGeneProducts} based on its identifier.
228   <p>
229   * @param sid a string representing the identifier of the {@link GeneProduct} to
230   * get.
231   <p>
232   * @return {@link GeneProduct} in this {@link ListOfGeneProducts} with the given id or null
233   * if no such {@link GeneProduct} exists.
234   <p>
235   * @see #get(long n)
236   * @see #size()
237   */ public
238 GeneProduct get(String sid) {
239    long cPtr = libsbmlJNI.ListOfGeneProducts_get__SWIG_2(swigCPtr, this, sid);
240    return (cPtr == 0) ? null : new GeneProduct(cPtr, false);
241  }
242
243  
244/**
245   * Adds a copy the given 'GeneProduct' to this {@link ListOfGeneProducts}.
246   <p>
247   * @param gp; the {@link GeneProduct} object to add
248   <p>
249   * @return integer value indicating success/failure of the
250   * function.   The possible values
251   * returned by this function are:
252   * <ul>
253   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
254   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
255   * </ul>
256   */ public
257 int addGeneProduct(GeneProduct gp) {
258    return libsbmlJNI.ListOfGeneProducts_addGeneProduct(swigCPtr, this, GeneProduct.getCPtr(gp), gp);
259  }
260
261  
262/**
263   * Get the number of {@link GeneProduct} objects in this {@link ListOfGeneProducts}.
264   <p>
265   * @return the number of {@link GeneProduct} objects in this {@link ListOfGeneProducts}
266   */ public
267 long getNumGeneProducts() {
268    return libsbmlJNI.ListOfGeneProducts_getNumGeneProducts(swigCPtr, this);
269  }
270
271  
272/**
273   * Creates a new {@link GeneProduct} object, adds it to the {@link ListOfGeneProducts} and
274   * returns the {@link GeneProduct} object created.
275   <p>
276   * @return a new {@link GeneProduct} object instance
277   <p>
278   * @see #addGeneProduct(GeneProduct gp)
279   */ public
280 GeneProduct createGeneProduct() {
281    long cPtr = libsbmlJNI.ListOfGeneProducts_createGeneProduct(swigCPtr, this);
282    return (cPtr == 0) ? null : new GeneProduct(cPtr, false);
283  }
284
285  
286/**
287   * Removes the nth {@link GeneProduct} from this {@link ListOfGeneProducts}
288   * and returns a pointer to it.
289   <p>
290   * The caller owns the returned item and is responsible for deleting it.
291   <p>
292   * @param n the index of the {@link GeneProduct} to remove.
293   <p>
294   * @see #size()
295   */ public
296 GeneProduct remove(long n) {
297    long cPtr = libsbmlJNI.ListOfGeneProducts_remove__SWIG_0(swigCPtr, this, n);
298    return (cPtr == 0) ? null : new GeneProduct(cPtr, true);
299  }
300
301  
302/**
303   * Removes the {@link GeneProduct} from this {@link ListOfGeneProducts} with the given
304   * identifier and returns a pointer to it.
305   <p>
306   * The caller owns the returned item and is responsible for deleting it.
307   * If none of the items in this list have the identifier <code>sid</code>, then
308   * <code>null</code> is returned.
309   <p>
310   * @param sid the identifier of the {@link GeneProduct} to remove.
311   <p>
312   * @return the {@link GeneProduct} removed. As mentioned above, the caller owns the
313   * returned item.
314   */ public
315 GeneProduct remove(String sid) {
316    long cPtr = libsbmlJNI.ListOfGeneProducts_remove__SWIG_1(swigCPtr, this, sid);
317    return (cPtr == 0) ? null : new GeneProduct(cPtr, true);
318  }
319
320  
321/**
322   * Returns the XML element name of this object.
323   <p>
324   * For {@link ListOfGeneProducts}, the XML element name is always @c
325   * 'listOfGeneProducts'.
326   <p>
327   * @return the name of this element, i.e. <code>'listOfGeneProducts'.</code>
328   */ public
329 String getElementName() {
330    return libsbmlJNI.ListOfGeneProducts_getElementName(swigCPtr, this);
331  }
332
333  
334/**
335   * Returns the libSBML type code for this SBML object.
336   <p>
337   * <p>
338 * LibSBML attaches an identifying code to every kind of SBML object.  These
339 * are integer constants known as <em>SBML type codes</em>.  The names of all
340 * the codes begin with the characters <code>SBML_</code>.
341 * In the Java language interface for libSBML, the
342 * type codes are defined as static integer constants in the interface class
343 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
344 * package plug-ins may use overlapping type codes; to identify the package
345 * to which a given object belongs, call the <code>getPackageName()</code>
346 * method on the object.
347   <p>
348   * @return the SBML type code for this object:
349   * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} (default).
350   <p>
351   * <p>
352 * @warning <span class='warning'>The specific integer values of the possible
353 * type codes may be reused by different Level&nbsp;3 package plug-ins.
354 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
355 * both getTypeCode() and getPackageName()</strong>.</span>
356   <p>
357   * @see #getElementName()
358   * @see #getPackageName()
359   */ public
360 int getTypeCode() {
361    return libsbmlJNI.ListOfGeneProducts_getTypeCode(swigCPtr, this);
362  }
363
364  
365/**
366   * Returns the libSBML type code for the objects contained in this {@link ListOf}.
367   <p>
368   * <p>
369 * LibSBML attaches an identifying code to every kind of SBML object.  These
370 * are integer constants known as <em>SBML type codes</em>.  The names of all
371 * the codes begin with the characters <code>SBML_</code>.
372 * In the Java language interface for libSBML, the
373 * type codes are defined as static integer constants in the interface class
374 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
375 * package plug-ins may use overlapping type codes; to identify the package
376 * to which a given object belongs, call the <code>getPackageName()</code>
377 * method on the object.
378   <p>
379   * @return the SBML type code for the objects contained in this {@link ListOf}
380   * instance: {@link libsbmlConstants#SBML_FBC_GENEPRODUCT SBML_FBC_GENEPRODUCT} (default).
381   <p>
382   * @see #getElementName()
383   * @see #getPackageName()
384   */ public
385 int getItemTypeCode() {
386    return libsbmlJNI.ListOfGeneProducts_getItemTypeCode(swigCPtr, this);
387  }
388
389}