001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.8
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 Objective} objects.
014 <p>
015 * The {@link ListOfObjectives} is a container for the SBML extended {@link Model}
016 * that lists all the possible {@link Objective} elements in the model.
017 <p>
018 * Unlike most other {@link ListOf} subclasses in SBML, SBML Level&nbsp;3 Flux
019 * Balance Constraints Version&nbsp;2 defines an additional required
020 * attribute on ListOfObjectives: the 'activeObjective' attribute.  This
021 * attribute is of type <code>SIdRef</code> and can only refer to the id of
022 * an existing {@link Objective}. This required attribute exists so that when
023 * multiple {@link Objective}'s are included in a single model, the model will always
024 * be well described; i.e., there will be a single, primary objective
025 * function which defines a single optimum and its associated solution space.
026 <p>
027 * <p>
028 * The various ListOf___ classes in SBML
029 * are merely containers used for organizing the main components of an SBML
030 * model.  In libSBML's implementation, ListOf___
031 * classes are derived from the
032 * intermediate utility class {@link ListOf}, which
033 * is not defined by the SBML specifications but serves as a useful
034 * programmatic construct.  {@link ListOf} is itself is in turn derived from {@link SBase},
035 * which provides all of the various ListOf___
036 * classes with common features
037 * defined by the SBML specification, such as 'metaid' attributes and
038 * annotations.
039 <p>
040 * The relationship between the lists and the rest of an SBML model is
041 * illustrated by the following (for SBML Level&nbsp;2 Version&nbsp;4):
042 <p>
043 * <figure>
044  <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object>
045</figure>
046
047 <p>
048 * Readers may wonder about the motivations for using the ListOf___
049 * containers in SBML.  A simpler approach in XML might be to place the
050 * components all directly at the top level of the model definition.  The
051 * choice made in SBML is to group them within XML elements named after
052 * ListOf<em>Classname</em>, in part because it helps organize the
053 * components.  More importantly, the fact that the container classes are
054 * derived from {@link SBase} means that software tools can add information <em>about</em>
055 * the lists themselves into each list container's 'annotation'.
056 <p>
057 * @see ListOfFunctionDefinitions
058 * @see ListOfUnitDefinitions
059 * @see ListOfCompartmentTypes
060 * @see ListOfSpeciesTypes
061 * @see ListOfCompartments
062 * @see ListOfSpecies
063 * @see ListOfParameters
064 * @see ListOfInitialAssignments
065 * @see ListOfRules
066 * @see ListOfConstraints
067 * @see ListOfReactions
068 * @see ListOfEvents
069 <p>
070 * 
071 * @warning The required attribute 'activeObjective' on {@link ListOfObjectives} is
072 * an additional attribute that is not present on typical {@link ListOf} classes.
073 * The introduction of an attribute on {@link ListOf} is perfectly legal in SBML, but
074 * uncommon, and software developers may have grown accustomed to {@link ListOf}
075 * classes all having the same attributes and no others.  We are belaboring
076 * this point so that developers are more likely to notice the presence of an
077 * additional attribute on {@link ListOfObjectives}.
078 <p>
079   * @see GeneProduct
080 * @see FbcModelPlugin
081 */
082
083public class ListOfObjectives extends ListOf {
084   private long swigCPtr;
085
086   protected ListOfObjectives(long cPtr, boolean cMemoryOwn)
087   {
088     super(libsbmlJNI.ListOfObjectives_SWIGUpcast(cPtr), cMemoryOwn);
089     swigCPtr = cPtr;
090   }
091
092   protected static long getCPtr(ListOfObjectives obj)
093   {
094     return (obj == null) ? 0 : obj.swigCPtr;
095   }
096
097   protected static long getCPtrAndDisown (ListOfObjectives obj)
098   {
099     long ptr = 0;
100
101     if (obj != null)
102     {
103       ptr             = obj.swigCPtr;
104       obj.swigCMemOwn = false;
105     }
106
107     return ptr;
108   }
109
110  protected void finalize() {
111    delete();
112  }
113
114  public synchronized void delete() {
115    if (swigCPtr != 0) {
116      if (swigCMemOwn) {
117        swigCMemOwn = false;
118        libsbmlJNI.delete_ListOfObjectives(swigCPtr);
119      }
120      swigCPtr = 0;
121    }
122    super.delete();
123  }
124
125  
126/**
127   * Creates a new {@link ListOfObjectives} with the given SBML Level, Version, and
128   * &ldquo;fbc&rdquo;package version.
129   <p>
130   * @param level a long integer, the SBML Level to assign to this
131   * {@link ListOfObjectives}
132   <p>
133   * @param version a long integer, the SBML Version to assign to this
134   * {@link ListOfObjectives}
135   <p>
136   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
137   * this {@link ListOfObjectives}
138   */ public
139 ListOfObjectives(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
140    this(libsbmlJNI.new_ListOfObjectives__SWIG_0(level, version, pkgVersion), true);
141  }
142
143  
144/**
145   * Creates a new {@link ListOfObjectives} with the given SBML Level, Version, and
146   * &ldquo;fbc&rdquo;package version.
147   <p>
148   * @param level a long integer, the SBML Level to assign to this
149   * {@link ListOfObjectives}
150   <p>
151   * @param version a long integer, the SBML Version to assign to this
152   * {@link ListOfObjectives}
153   <p>
154   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
155   * this {@link ListOfObjectives}
156   */ public
157 ListOfObjectives(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
158    this(libsbmlJNI.new_ListOfObjectives__SWIG_1(level, version), true);
159  }
160
161  
162/**
163   * Creates a new {@link ListOfObjectives} with the given SBML Level, Version, and
164   * &ldquo;fbc&rdquo;package version.
165   <p>
166   * @param level a long integer, the SBML Level to assign to this
167   * {@link ListOfObjectives}
168   <p>
169   * @param version a long integer, the SBML Version to assign to this
170   * {@link ListOfObjectives}
171   <p>
172   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
173   * this {@link ListOfObjectives}
174   */ public
175 ListOfObjectives(long level) throws org.sbml.libsbml.SBMLConstructorException {
176    this(libsbmlJNI.new_ListOfObjectives__SWIG_2(level), true);
177  }
178
179  
180/**
181   * Creates a new {@link ListOfObjectives} with the given SBML Level, Version, and
182   * &ldquo;fbc&rdquo;package version.
183   <p>
184   * @param level a long integer, the SBML Level to assign to this
185   * {@link ListOfObjectives}
186   <p>
187   * @param version a long integer, the SBML Version to assign to this
188   * {@link ListOfObjectives}
189   <p>
190   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
191   * this {@link ListOfObjectives}
192   */ public
193 ListOfObjectives() throws org.sbml.libsbml.SBMLConstructorException {
194    this(libsbmlJNI.new_ListOfObjectives__SWIG_3(), true);
195  }
196
197  
198/**
199   * Creates a new {@link ListOfObjectives} with the given {@link FbcPkgNamespaces} object.
200   <p>
201   * @param fbcns the {@link FbcPkgNamespaces} object
202   */ public
203 ListOfObjectives(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
204    this(libsbmlJNI.new_ListOfObjectives__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
205  }
206
207  
208/**
209   * Copy Constructor.
210   */ public
211 ListOfObjectives(ListOfObjectives other) throws org.sbml.libsbml.SBMLConstructorException {
212    this(libsbmlJNI.new_ListOfObjectives__SWIG_5(ListOfObjectives.getCPtr(other), other), true);
213  }
214
215  
216/**
217   * Creates and returns a deep copy of this {@link ListOfObjectives} object.
218   <p>
219   * @return a (deep) copy of this {@link ListOfObjectives} object.
220   */ public
221 ListOfObjectives cloneObject() {
222    long cPtr = libsbmlJNI.ListOfObjectives_cloneObject(swigCPtr, this);
223    return (cPtr == 0) ? null : new ListOfObjectives(cPtr, true);
224  }
225
226  
227/**
228   * Get an {@link Objective} from the {@link ListOfObjectives}.
229   <p>
230   * @param n the index number of the {@link Objective} to get.
231   <p>
232   * @return the nth {@link Objective} in this {@link ListOfObjectives}.
233   <p>
234   * @see #size()
235   */ public
236 Objective get(long n) {
237    long cPtr = libsbmlJNI.ListOfObjectives_get__SWIG_0(swigCPtr, this, n);
238    return (cPtr == 0) ? null : new Objective(cPtr, false);
239  }
240
241  
242/**
243   * Get an {@link Objective} from the {@link ListOfObjectives} based on its identifier.
244   <p>
245   * @param sid a string representing the identifier of the {@link Objective} to get.
246   <p>
247   * @return {@link Objective} in this {@link ListOfObjectives} with the given id or null if
248   * no such {@link Objective} exists.
249   <p>
250   * @see #get(long n)
251   * @see #size()
252   */ public
253 Objective get(String sid) {
254    long cPtr = libsbmlJNI.ListOfObjectives_get__SWIG_2(swigCPtr, this, sid);
255    return (cPtr == 0) ? null : new Objective(cPtr, false);
256  }
257
258  
259/**
260   * Adds a copy the given 'Objective' to this {@link ListOfObjectives}.
261   <p>
262   * @param o; the {@link Objective} object to add
263   <p>
264   * @return integer value indicating success/failure of the
265   * function.   The possible values
266   * returned by this function are:
267   * <ul>
268   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
269   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
270   * </ul>
271   */ public
272 int addObjective(Objective o) {
273    return libsbmlJNI.ListOfObjectives_addObjective(swigCPtr, this, Objective.getCPtr(o), o);
274  }
275
276  
277/**
278   * Get the number of {@link Objective} objects in this {@link ListOfObjectives}.
279   <p>
280   * @return the number of {@link Objective} objects in this {@link ListOfObjectives}
281   */ public
282 long getNumObjectives() {
283    return libsbmlJNI.ListOfObjectives_getNumObjectives(swigCPtr, this);
284  }
285
286  
287/**
288   * Creates a new {@link Objective} object, adds it to the
289   * {@link ListOfObjectives} and returns the {@link Objective} object created. 
290   <p>
291   * @return a new {@link Objective} object instance
292   <p>
293   * @see #addObjective(Objective o)
294   */ public
295 Objective createObjective() {
296    long cPtr = libsbmlJNI.ListOfObjectives_createObjective(swigCPtr, this);
297    return (cPtr == 0) ? null : new Objective(cPtr, false);
298  }
299
300  
301/**
302   * Removes the nth {@link Objective} from this {@link ListOfObjectives}
303   * and returns a pointer to it.
304   <p>
305   * The caller owns the returned item and is responsible for deleting it.
306   <p>
307   * @param n the index of the {@link Objective} to remove.
308   <p>
309   * @see #size()
310   */ public
311 Objective remove(long n) {
312    long cPtr = libsbmlJNI.ListOfObjectives_remove__SWIG_0(swigCPtr, this, n);
313    return (cPtr == 0) ? null : new Objective(cPtr, true);
314  }
315
316  
317/**
318   * Removes the {@link Objective} from this {@link ListOfObjectives} with the given identifier
319   * and returns a pointer to it.
320   <p>
321   * The caller owns the returned item and is responsible for deleting it.
322   * If none of the items in this list have the identifier <code>sid</code>, then
323   * <code>null</code> is returned.
324   <p>
325   * @param sid the identifier of the {@link Objective} to remove.
326   <p>
327   * @return the {@link Objective} removed. As mentioned above, the caller owns the
328   * returned item.
329   */ public
330 Objective remove(String sid) {
331    long cPtr = libsbmlJNI.ListOfObjectives_remove__SWIG_1(swigCPtr, this, sid);
332    return (cPtr == 0) ? null : new Objective(cPtr, true);
333  }
334
335  
336/**
337   * Returns the XML element name of this object.
338   <p>
339   * For {@link ListOfObjectives}, the XML element name is always <code>'listOfObjectives'.</code>
340   <p>
341   * @return the name of this element, i.e. <code>'listOfObjectives'.</code>
342   */ public
343 String getElementName() {
344    return libsbmlJNI.ListOfObjectives_getElementName(swigCPtr, this);
345  }
346
347  
348/**
349  * Predicate returning <code>true</code> if this ListOfObjective's 'activeObjective'
350  * attribute is set.
351  <p>
352  * @return <code>true</code> if this ListOfObjective's 'activeObjective' attribute has been set,
353  * otherwise <code>false</code> is returned.
354  */ public
355 boolean isSetActiveObjective() {
356    return libsbmlJNI.ListOfObjectives_isSetActiveObjective(swigCPtr, this);
357  }
358
359  
360/**
361  * Sets the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
362  <p>
363  * <p>
364 * @return integer value indicating success/failure of the
365 * function.   The possible values
366 * returned by this function are:
367  * <ul>
368  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
369  * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
370  * </ul>
371  */ public
372 int setActiveObjective(String activeObjective) {
373    return libsbmlJNI.ListOfObjectives_setActiveObjective(swigCPtr, this, activeObjective);
374  }
375
376  
377/**
378  * Returns the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
379  <p>
380  * @return the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
381  */ public
382 String getActiveObjective() {
383    return libsbmlJNI.ListOfObjectives_getActiveObjective(swigCPtr, this);
384  }
385
386  
387/**
388  * Unsets the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
389  <p>
390  * <p>
391 * @return integer value indicating success/failure of the
392 * function.   The possible values
393 * returned by this function are:
394  * <ul>
395  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
396  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
397  * </ul>
398  */ public
399 int unsetActiveObjective() {
400    return libsbmlJNI.ListOfObjectives_unsetActiveObjective(swigCPtr, this);
401  }
402
403  
404/**
405   * Returns the libSBML type code for this SBML object.
406   <p>
407   * <p>
408 * LibSBML attaches an identifying code to every kind of SBML object.  These
409 * are integer constants known as <em>SBML type codes</em>.  The names of all
410 * the codes begin with the characters <code>SBML_</code>.
411 * In the Java language interface for libSBML, the
412 * type codes are defined as static integer constants in the interface class
413 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
414 * package plug-ins may use overlapping type codes; to identify the package
415 * to which a given object belongs, call the <code>getPackageName()</code>
416 * method on the object.
417   <p>
418   * @return the SBML type code for this object:
419   * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} (default).
420   <p>
421   * <p>
422 * @warning <span class='warning'>The specific integer values of the possible
423 * type codes may be reused by different Level&nbsp;3 package plug-ins.
424 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
425 * both getTypeCode() and getPackageName()</strong>.</span>
426   <p>
427   * @see #getElementName()
428   * @see #getPackageName()
429   */ public
430 int getTypeCode() {
431    return libsbmlJNI.ListOfObjectives_getTypeCode(swigCPtr, this);
432  }
433
434  
435/**
436   * Returns the libSBML type code for the objects contained in this {@link ListOf}.
437   <p>
438   * <p>
439 * LibSBML attaches an identifying code to every kind of SBML object.  These
440 * are integer constants known as <em>SBML type codes</em>.  The names of all
441 * the codes begin with the characters <code>SBML_</code>.
442 * In the Java language interface for libSBML, the
443 * type codes are defined as static integer constants in the interface class
444 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
445 * package plug-ins may use overlapping type codes; to identify the package
446 * to which a given object belongs, call the <code>getPackageName()</code>
447 * method on the object.
448   <p>
449   * @return the SBML type code for the objects contained in this {@link ListOf}
450   * instance: {@link libsbmlConstants#SBML_FBC_OBJECTIVE SBML_FBC_OBJECTIVE} (default).
451   <p>
452   * @see #getElementName()
453   * @see #getPackageName()
454   */ public
455 int getItemTypeCode() {
456    return libsbmlJNI.ListOfObjectives_getItemTypeCode(swigCPtr, this);
457  }
458
459  
460/**
461  * Adds a clone of all items in the provided {@link ListOf} to this object.
462  <p>
463  * This means that when this {@link ListOf} is destroyed, the original items will
464  * not be destroyed.  In addition, copy over the input {@link ListOfObjectives}'
465  * 'activeObjective' attribute, if none is set for this element.
466  <p>
467  * @param list A list of items to be added.
468  <p>
469  * @see #append(SBase item)
470  */ public
471 int appendFrom(ListOf list) {
472    return libsbmlJNI.ListOfObjectives_appendFrom(swigCPtr, this, ListOf.getCPtr(list), list);
473  }
474
475  
476/**
477  * <p>
478 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
479 * value.
480 <p>
481 * <p>
482 * In SBML, object identifiers are of a data type called <code>SId</code>.
483 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
484 * introduced for attribute values that refer to <code>SId</code> values; in
485 * previous Levels of SBML, this data type did not exist and attributes were
486 * simply described to as 'referring to an identifier', but the effective
487 * data type was the same as <code>SIdRef</code>in Level&nbsp;3.  These and
488 * other methods of libSBML refer to the type <code>SIdRef</code> for all
489 * Levels of SBML, even if the corresponding SBML specification did not
490 * explicitly name the data type.
491 <p>
492 * This method works by looking at all attributes and (if appropriate)
493 * mathematical formulas in MathML content, comparing the referenced
494 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
495 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
496 * descend into child elements.
497 <p>
498 * @param oldid the old identifier
499 * @param newid the new identifier
500  */ public
501 void renameSIdRefs(String oldid, String newid) {
502    libsbmlJNI.ListOfObjectives_renameSIdRefs(swigCPtr, this, oldid, newid);
503  }
504
505}