001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.12
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 * SBML Level&nbsp;3 Version&nbsp;1 has essentially the same structure as 
041 * Level&nbsp;2 Version&nbsp;4, depicted above, but SBML Level&nbsp;3 
042 * Version&nbsp;2 allows
043 * containers to contain zero or more of the relevant object, instead of 
044 * requiring at least one.  As such, libsbml will write out an 
045 * otherwise-empty ListOf___ element that has any optional attribute set 
046 * (such as 'id' or 'metaid'), that has an optional child (such 
047 * as a 'notes' or 'annotation'), or that has attributes or children set
048 * from any SBML Level&nbsp;3 package, whether or not the ListOf___ has 
049 * any other children.
050 <p>
051 * Readers may wonder about the motivations for using the ListOf___
052 * containers in SBML.  A simpler approach in XML might be to place the
053 * components all directly at the top level of the model definition.  The
054 * choice made in SBML is to group them within XML elements named after
055 * ListOf<em>Classname</em>, in part because it helps organize the
056 * components.  More importantly, the fact that the container classes are
057 * derived from {@link SBase} means that software tools can add information <em>about</em>
058 * the lists themselves into each list container's 'annotation'.
059 <p>
060 * @see ListOfFunctionDefinitions
061 * @see ListOfUnitDefinitions
062 * @see ListOfCompartmentTypes
063 * @see ListOfSpeciesTypes
064 * @see ListOfCompartments
065 * @see ListOfSpecies
066 * @see ListOfParameters
067 * @see ListOfInitialAssignments
068 * @see ListOfRules
069 * @see ListOfConstraints
070 * @see ListOfReactions
071 * @see ListOfEvents
072 <p>
073 * @see Objective
074 * @see FluxObjective
075 */
076
077public class ListOfFluxObjectives extends ListOf {
078   private long swigCPtr;
079
080   protected ListOfFluxObjectives(long cPtr, boolean cMemoryOwn)
081   {
082     super(libsbmlJNI.ListOfFluxObjectives_SWIGUpcast(cPtr), cMemoryOwn);
083     swigCPtr = cPtr;
084   }
085
086   protected static long getCPtr(ListOfFluxObjectives obj)
087   {
088     return (obj == null) ? 0 : obj.swigCPtr;
089   }
090
091   protected static long getCPtrAndDisown (ListOfFluxObjectives obj)
092   {
093     long ptr = 0;
094
095     if (obj != null)
096     {
097       ptr             = obj.swigCPtr;
098       obj.swigCMemOwn = false;
099     }
100
101     return ptr;
102   }
103
104  protected void finalize() {
105    delete();
106  }
107
108  public synchronized void delete() {
109    if (swigCPtr != 0) {
110      if (swigCMemOwn) {
111        swigCMemOwn = false;
112        libsbmlJNI.delete_ListOfFluxObjectives(swigCPtr);
113      }
114      swigCPtr = 0;
115    }
116    super.delete();
117  }
118
119  
120/**
121   * Creates a new {@link ListOfFluxObjectives} with the given level, version, and package version.
122   <p>
123   * @param level a long integer, the SBML Level to assign to this {@link ListOfFluxObjectives}.
124   <p>
125   * @param version a long integer, the SBML Version to assign to this {@link ListOfFluxObjectives}.
126   <p>
127   * @param pkgVersion a long integer, the SBML Fbc Version to assign to this {@link ListOfFluxObjectives}.
128   <p>
129   * <p>
130 * @note Attempting to add an object to an {@link SBMLDocument} having a different
131 * combination of SBML Level, Version and XML namespaces than the object
132 * itself will result in an error at the time a caller attempts to make the
133 * addition.  A parent object must have compatible Level, Version and XML
134 * namespaces.  (Strictly speaking, a parent may also have more XML
135 * namespaces than a child, but the reverse is not permitted.)  The
136 * restriction is necessary to ensure that an SBML model has a consistent
137 * overall structure.  This requires callers to manage their objects
138 * carefully, but the benefit is increased flexibility in how models can be
139 * created by permitting callers to create objects bottom-up if desired.  In
140 * situations where objects are not yet attached to parents (e.g.,
141 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
142 * libSBML determine such things as whether it is valid to assign a
143 * particular value to an attribute.  For packages, this means that the 
144 * parent object to which this package element is being added must have
145 * been created with the package namespace, or that the package namespace
146 * was added to it, even if that parent is not a package object itself.
147   */ public
148 ListOfFluxObjectives(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
149    this(libsbmlJNI.new_ListOfFluxObjectives__SWIG_0(level, version, pkgVersion), true);
150  }
151
152  
153/**
154   * Creates a new {@link ListOfFluxObjectives} with the given level, version, and package version.
155   <p>
156   * @param level a long integer, the SBML Level to assign to this {@link ListOfFluxObjectives}.
157   <p>
158   * @param version a long integer, the SBML Version to assign to this {@link ListOfFluxObjectives}.
159   <p>
160   * @param pkgVersion a long integer, the SBML Fbc Version to assign to this {@link ListOfFluxObjectives}.
161   <p>
162   * <p>
163 * @note Attempting to add an object to an {@link SBMLDocument} having a different
164 * combination of SBML Level, Version and XML namespaces than the object
165 * itself will result in an error at the time a caller attempts to make the
166 * addition.  A parent object must have compatible Level, Version and XML
167 * namespaces.  (Strictly speaking, a parent may also have more XML
168 * namespaces than a child, but the reverse is not permitted.)  The
169 * restriction is necessary to ensure that an SBML model has a consistent
170 * overall structure.  This requires callers to manage their objects
171 * carefully, but the benefit is increased flexibility in how models can be
172 * created by permitting callers to create objects bottom-up if desired.  In
173 * situations where objects are not yet attached to parents (e.g.,
174 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
175 * libSBML determine such things as whether it is valid to assign a
176 * particular value to an attribute.  For packages, this means that the 
177 * parent object to which this package element is being added must have
178 * been created with the package namespace, or that the package namespace
179 * was added to it, even if that parent is not a package object itself.
180   */ public
181 ListOfFluxObjectives(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
182    this(libsbmlJNI.new_ListOfFluxObjectives__SWIG_1(level, version), true);
183  }
184
185  
186/**
187   * Creates a new {@link ListOfFluxObjectives} with the given level, version, and package version.
188   <p>
189   * @param level a long integer, the SBML Level to assign to this {@link ListOfFluxObjectives}.
190   <p>
191   * @param version a long integer, the SBML Version to assign to this {@link ListOfFluxObjectives}.
192   <p>
193   * @param pkgVersion a long integer, the SBML Fbc Version to assign to this {@link ListOfFluxObjectives}.
194   <p>
195   * <p>
196 * @note Attempting to add an object to an {@link SBMLDocument} having a different
197 * combination of SBML Level, Version and XML namespaces than the object
198 * itself will result in an error at the time a caller attempts to make the
199 * addition.  A parent object must have compatible Level, Version and XML
200 * namespaces.  (Strictly speaking, a parent may also have more XML
201 * namespaces than a child, but the reverse is not permitted.)  The
202 * restriction is necessary to ensure that an SBML model has a consistent
203 * overall structure.  This requires callers to manage their objects
204 * carefully, but the benefit is increased flexibility in how models can be
205 * created by permitting callers to create objects bottom-up if desired.  In
206 * situations where objects are not yet attached to parents (e.g.,
207 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
208 * libSBML determine such things as whether it is valid to assign a
209 * particular value to an attribute.  For packages, this means that the 
210 * parent object to which this package element is being added must have
211 * been created with the package namespace, or that the package namespace
212 * was added to it, even if that parent is not a package object itself.
213   */ public
214 ListOfFluxObjectives(long level) throws org.sbml.libsbml.SBMLConstructorException {
215    this(libsbmlJNI.new_ListOfFluxObjectives__SWIG_2(level), true);
216  }
217
218  
219/**
220   * Creates a new {@link ListOfFluxObjectives} with the given level, version, and package version.
221   <p>
222   * @param level a long integer, the SBML Level to assign to this {@link ListOfFluxObjectives}.
223   <p>
224   * @param version a long integer, the SBML Version to assign to this {@link ListOfFluxObjectives}.
225   <p>
226   * @param pkgVersion a long integer, the SBML Fbc Version to assign to this {@link ListOfFluxObjectives}.
227   <p>
228   * <p>
229 * @note Attempting to add an object to an {@link SBMLDocument} having a different
230 * combination of SBML Level, Version and XML namespaces than the object
231 * itself will result in an error at the time a caller attempts to make the
232 * addition.  A parent object must have compatible Level, Version and XML
233 * namespaces.  (Strictly speaking, a parent may also have more XML
234 * namespaces than a child, but the reverse is not permitted.)  The
235 * restriction is necessary to ensure that an SBML model has a consistent
236 * overall structure.  This requires callers to manage their objects
237 * carefully, but the benefit is increased flexibility in how models can be
238 * created by permitting callers to create objects bottom-up if desired.  In
239 * situations where objects are not yet attached to parents (e.g.,
240 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
241 * libSBML determine such things as whether it is valid to assign a
242 * particular value to an attribute.  For packages, this means that the 
243 * parent object to which this package element is being added must have
244 * been created with the package namespace, or that the package namespace
245 * was added to it, even if that parent is not a package object itself.
246   */ public
247 ListOfFluxObjectives() throws org.sbml.libsbml.SBMLConstructorException {
248    this(libsbmlJNI.new_ListOfFluxObjectives__SWIG_3(), true);
249  }
250
251  
252/**
253   * Creates a new {@link ListOfFluxObjectives} with the given {@link FbcPkgNamespaces} object.
254   <p>
255   * <p>
256 * The package namespaces object used in this constructor is derived from a
257 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
258 * information.  It is used to communicate the SBML Level, Version, and 
259 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
260 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
261 * package namespace object somewhere in a program once, then hand that object
262 * as needed to object constructors of that package that accept it as and
263 * argument, such as this one.
264   <p>
265   * @param fbcns the {@link FbcPkgNamespaces} object.
266   <p>
267   * <p>
268 * @note Attempting to add an object to an {@link SBMLDocument} having a different
269 * combination of SBML Level, Version and XML namespaces than the object
270 * itself will result in an error at the time a caller attempts to make the
271 * addition.  A parent object must have compatible Level, Version and XML
272 * namespaces.  (Strictly speaking, a parent may also have more XML
273 * namespaces than a child, but the reverse is not permitted.)  The
274 * restriction is necessary to ensure that an SBML model has a consistent
275 * overall structure.  This requires callers to manage their objects
276 * carefully, but the benefit is increased flexibility in how models can be
277 * created by permitting callers to create objects bottom-up if desired.  In
278 * situations where objects are not yet attached to parents (e.g.,
279 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
280 * libSBML determine such things as whether it is valid to assign a
281 * particular value to an attribute.  For packages, this means that the 
282 * parent object to which this package element is being added must have
283 * been created with the package namespace, or that the package namespace
284 * was added to it, even if that parent is not a package object itself.
285   */ public
286 ListOfFluxObjectives(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
287    this(libsbmlJNI.new_ListOfFluxObjectives__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
288  }
289
290  
291/**
292   * Creates and returns a deep copy of this {@link ListOfFluxObjectives} object.
293   <p>
294   * @return a (deep) copy of this {@link ListOfFluxObjectives} object.
295   */ public
296 ListOfFluxObjectives cloneObject() {
297    long cPtr = libsbmlJNI.ListOfFluxObjectives_cloneObject(swigCPtr, this);
298    return (cPtr == 0) ? null : new ListOfFluxObjectives(cPtr, true);
299  }
300
301  
302/**
303   * Get a {@link FluxObjective} from the {@link ListOfFluxObjectives}.
304   <p>
305   * @param n the index number of the {@link FluxObjective} to get.
306   <p>
307   * @return the nth {@link FluxObjective} in this {@link ListOfFluxObjectives}.
308   <p>
309   * @see #size()
310   */ public
311 FluxObjective get(long n) {
312    long cPtr = libsbmlJNI.ListOfFluxObjectives_get__SWIG_0(swigCPtr, this, n);
313    return (cPtr == 0) ? null : new FluxObjective(cPtr, false);
314  }
315
316  
317/**
318   * Get a {@link FluxObjective} from the {@link ListOfFluxObjectives}
319   * based on its identifier.
320   <p>
321   * @param sid a string representing the identifier
322   * of the {@link FluxObjective} to get.
323   <p>
324   * @return {@link FluxObjective} in this {@link ListOfFluxObjectives}
325   * with the given id or <code>null</code> if no such
326   * {@link FluxObjective} exists.
327   <p>
328   * @see #get(long n)   *
329   * @see #size()
330   */ public
331 FluxObjective get(String sid) {
332    long cPtr = libsbmlJNI.ListOfFluxObjectives_get__SWIG_2(swigCPtr, this, sid);
333    return (cPtr == 0) ? null : new FluxObjective(cPtr, false);
334  }
335
336  
337/**
338    * Adds a copy the given {@link FluxObjective} to this {@link ListOfFluxObjectives}.
339    <p>
340    * @param fo the {@link FluxObjective} object to add.
341    <p>
342    * <p>
343 * @return integer value indicating success/failure of the
344 * function.   The possible values
345 * returned by this function are:
346    * <ul>
347    * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
348    * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
349    * </ul>
350    */ public
351 int addFluxObjective(FluxObjective fo) {
352    return libsbmlJNI.ListOfFluxObjectives_addFluxObjective(swigCPtr, this, FluxObjective.getCPtr(fo), fo);
353  }
354
355  
356/**
357   * Get the number of {@link FluxObjective} objects in this {@link ListOfFluxObjectives}.
358   <p>
359   * @return the number of {@link FluxObjective} objects in this {@link ListOfFluxObjectives}
360   */ public
361 long getNumFluxObjectives() {
362    return libsbmlJNI.ListOfFluxObjectives_getNumFluxObjectives(swigCPtr, this);
363  }
364
365  
366/**
367   * Creates a new {@link FluxObjective} object, adds it to the
368   * {@link ListOfFluxObjectives} and returns the {@link FluxObjective} object created. 
369   <p>
370   * @return a new {@link FluxObjective} object instance
371   <p>
372   * @see #addFluxObjective(FluxObjective fo)
373   */ public
374 FluxObjective createFluxObjective() {
375    long cPtr = libsbmlJNI.ListOfFluxObjectives_createFluxObjective(swigCPtr, this);
376    return (cPtr == 0) ? null : new FluxObjective(cPtr, false);
377  }
378
379  
380/**
381   * Removes the nth {@link FluxObjective} from this {@link ListOfFluxObjectives}
382   * and returns a pointer to it.
383   <p>
384   * The caller owns the returned item and is responsible for deleting it.
385   <p>
386   * @param n the index of the {@link FluxObjective} to remove.
387   <p>
388   * @see #size()
389   */ public
390 FluxObjective remove(long n) {
391    long cPtr = libsbmlJNI.ListOfFluxObjectives_remove__SWIG_0(swigCPtr, this, n);
392    return (cPtr == 0) ? null : new FluxObjective(cPtr, true);
393  }
394
395  
396/**
397   * Removes the {@link FluxObjective} from this {@link ListOfFluxObjectives} with the given identifier
398   * and returns a pointer to it.
399   <p>
400   * The caller owns the returned item and is responsible for deleting it.
401   * If none of the items in this list have the identifier <code>sid</code>, then
402   * <code>null</code> is returned.
403   <p>
404   * @param sid the identifier of the {@link FluxObjective} to remove.
405   <p>
406   * @return the {@link FluxObjective} removed. As mentioned above, the caller owns the
407   * returned item.
408   */ public
409 FluxObjective remove(String sid) {
410    long cPtr = libsbmlJNI.ListOfFluxObjectives_remove__SWIG_1(swigCPtr, this, sid);
411    return (cPtr == 0) ? null : new FluxObjective(cPtr, true);
412  }
413
414  
415/**
416   * Returns the XML element name of this object.
417   <p>
418   * For {@link ListOfFluxObjectives}, the XML element name is always <code>'listOfFluxObjectives'.</code>
419   <p>
420   * @return the name of this element, i.e. <code>'listOfFluxObjectives'.</code>
421   */ public
422 String getElementName() {
423    return libsbmlJNI.ListOfFluxObjectives_getElementName(swigCPtr, this);
424  }
425
426  
427/**
428   * Returns the libSBML type code for this SBML object.
429   <p>
430   * <p>
431 * LibSBML attaches an identifying code to every kind of SBML object.  These
432 * are integer constants known as <em>SBML type codes</em>.  The names of all
433 * the codes begin with the characters <code>SBML_</code>.
434 * In the Java language interface for libSBML, the
435 * type codes are defined as static integer constants in the interface class
436 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
437 * package plug-ins may use overlapping type codes; to identify the package
438 * to which a given object belongs, call the 
439 * <code>{@link SBase#getPackageName()}
440 * </code>
441 * method on the object.
442   <p>
443   * @return the SBML type code for this object:
444   * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} (default).
445   <p>
446   * <p>
447 * @warning <span class='warning'>The specific integer values of the possible
448 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
449 * packages,  To fully identify the correct code, <strong>it is necessary to
450 * invoke both getTypeCode() and getPackageName()</strong>.</span>
451   <p>
452   * @see #getElementName()
453   * @see #getPackageName()
454   */ public
455 int getTypeCode() {
456    return libsbmlJNI.ListOfFluxObjectives_getTypeCode(swigCPtr, this);
457  }
458
459  
460/**
461   * Returns the libSBML type code for the objects contained in this {@link ListOf}.
462   <p>
463   * <p>
464 * LibSBML attaches an identifying code to every kind of SBML object.  These
465 * are integer constants known as <em>SBML type codes</em>.  The names of all
466 * the codes begin with the characters <code>SBML_</code>.
467 * In the Java language interface for libSBML, the
468 * type codes are defined as static integer constants in the interface class
469 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
470 * package plug-ins may use overlapping type codes; to identify the package
471 * to which a given object belongs, call the 
472 * <code>{@link SBase#getPackageName()}
473 * </code>
474 * method on the object.
475   <p>
476   * @return the SBML type code for the objects contained in this {@link ListOf}
477   * instance: {@link libsbmlConstants#SBML_FBC_FLUXOBJECTIVE SBML_FBC_FLUXOBJECTIVE} (default).
478   <p>
479   * @see #getElementName()
480   * @see #getPackageName()
481   */ public
482 int getItemTypeCode() {
483    return libsbmlJNI.ListOfFluxObjectives_getItemTypeCode(swigCPtr, this);
484  }
485
486}