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