001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.10
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 <a href='../../../extensions-summary.html#fbc'>Flux Balance Constraints</a>
019 * Version&nbsp;2 defines an additional required attribute on
020 * ListOfObjectives: the 'activeObjective' attribute.  This attribute is of
021 * type <code>SIdRef</code> and can only refer to the id of an existing
022 * {@link Objective}. This required attribute exists so that when multiple
023 * {@link Objective}'s are included in a single model, the model will always be well
024 * described; i.e., there will be a single, primary objective function which
025 * 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 * 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 * 
063 * @warning The required attribute 'activeObjective' on {@link ListOfObjectives} is
064 * an additional attribute that is not present on typical {@link ListOf} classes.
065 * The introduction of an attribute on {@link ListOf} is perfectly legal in SBML, but
066 * uncommon, and software developers may have grown accustomed to {@link ListOf}
067 * classes all having the same attributes and no others.  We are belaboring
068 * this point so that developers are more likely to notice the presence of an
069 * additional attribute on {@link ListOfObjectives}.
070 <p>
071   * @see GeneProduct
072 * @see FbcModelPlugin
073 */
074
075public class ListOfObjectives extends ListOf {
076   private long swigCPtr;
077
078   protected ListOfObjectives(long cPtr, boolean cMemoryOwn)
079   {
080     super(libsbmlJNI.ListOfObjectives_SWIGUpcast(cPtr), cMemoryOwn);
081     swigCPtr = cPtr;
082   }
083
084   protected static long getCPtr(ListOfObjectives obj)
085   {
086     return (obj == null) ? 0 : obj.swigCPtr;
087   }
088
089   protected static long getCPtrAndDisown (ListOfObjectives 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_ListOfObjectives(swigCPtr);
111      }
112      swigCPtr = 0;
113    }
114    super.delete();
115  }
116
117  
118/**
119   * Creates a new {@link ListOfObjectives} 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 ListOfObjectives}
124   <p>
125   * @param version a long integer, the SBML Version to assign to this
126   * {@link ListOfObjectives}
127   <p>
128   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
129   * this {@link ListOfObjectives}
130   */ public
131 ListOfObjectives(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
132    this(libsbmlJNI.new_ListOfObjectives__SWIG_0(level, version, pkgVersion), true);
133  }
134
135  
136/**
137   * Creates a new {@link ListOfObjectives} 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 ListOfObjectives}
142   <p>
143   * @param version a long integer, the SBML Version to assign to this
144   * {@link ListOfObjectives}
145   <p>
146   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
147   * this {@link ListOfObjectives}
148   */ public
149 ListOfObjectives(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
150    this(libsbmlJNI.new_ListOfObjectives__SWIG_1(level, version), true);
151  }
152
153  
154/**
155   * Creates a new {@link ListOfObjectives} 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 ListOfObjectives}
160   <p>
161   * @param version a long integer, the SBML Version to assign to this
162   * {@link ListOfObjectives}
163   <p>
164   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
165   * this {@link ListOfObjectives}
166   */ public
167 ListOfObjectives(long level) throws org.sbml.libsbml.SBMLConstructorException {
168    this(libsbmlJNI.new_ListOfObjectives__SWIG_2(level), true);
169  }
170
171  
172/**
173   * Creates a new {@link ListOfObjectives} 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 ListOfObjectives}
178   <p>
179   * @param version a long integer, the SBML Version to assign to this
180   * {@link ListOfObjectives}
181   <p>
182   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
183   * this {@link ListOfObjectives}
184   */ public
185 ListOfObjectives() throws org.sbml.libsbml.SBMLConstructorException {
186    this(libsbmlJNI.new_ListOfObjectives__SWIG_3(), true);
187  }
188
189  
190/**
191   * Creates a new {@link ListOfObjectives} with the given {@link FbcPkgNamespaces} object.
192   <p>
193   * @param fbcns the {@link FbcPkgNamespaces} object
194   */ public
195 ListOfObjectives(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
196    this(libsbmlJNI.new_ListOfObjectives__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
197  }
198
199  
200/**
201   * Copy Constructor.
202   */ public
203 ListOfObjectives(ListOfObjectives other) throws org.sbml.libsbml.SBMLConstructorException {
204    this(libsbmlJNI.new_ListOfObjectives__SWIG_5(ListOfObjectives.getCPtr(other), other), true);
205  }
206
207  
208/**
209   * Creates and returns a deep copy of this {@link ListOfObjectives} object.
210   <p>
211   * @return a (deep) copy of this {@link ListOfObjectives} object.
212   */ public
213 ListOfObjectives cloneObject() {
214    long cPtr = libsbmlJNI.ListOfObjectives_cloneObject(swigCPtr, this);
215    return (cPtr == 0) ? null : new ListOfObjectives(cPtr, true);
216  }
217
218  
219/**
220   * Get an {@link Objective} from the {@link ListOfObjectives}.
221   <p>
222   * @param n the index number of the {@link Objective} to get.
223   <p>
224   * @return the nth {@link Objective} in this {@link ListOfObjectives}.
225   <p>
226   * @see #size()
227   */ public
228 Objective get(long n) {
229    long cPtr = libsbmlJNI.ListOfObjectives_get__SWIG_0(swigCPtr, this, n);
230    return (cPtr == 0) ? null : new Objective(cPtr, false);
231  }
232
233  
234/**
235   * Get an {@link Objective} from the {@link ListOfObjectives} based on its identifier.
236   <p>
237   * @param sid a string representing the identifier of the {@link Objective} to get.
238   <p>
239   * @return {@link Objective} in this {@link ListOfObjectives} with the given id or null if
240   * no such {@link Objective} exists.
241   <p>
242   * @see #get(long n)
243   * @see #size()
244   */ public
245 Objective get(String sid) {
246    long cPtr = libsbmlJNI.ListOfObjectives_get__SWIG_2(swigCPtr, this, sid);
247    return (cPtr == 0) ? null : new Objective(cPtr, false);
248  }
249
250  
251/**
252   * Adds a copy the given 'Objective' to this {@link ListOfObjectives}.
253   <p>
254   * @param o; the {@link Objective} object to add
255   <p>
256   * @return integer value indicating success/failure of the
257   * function.   The possible values
258   * returned by this function are:
259   * <ul>
260   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
261   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
262   * </ul>
263   */ public
264 int addObjective(Objective o) {
265    return libsbmlJNI.ListOfObjectives_addObjective(swigCPtr, this, Objective.getCPtr(o), o);
266  }
267
268  
269/**
270   * Get the number of {@link Objective} objects in this {@link ListOfObjectives}.
271   <p>
272   * @return the number of {@link Objective} objects in this {@link ListOfObjectives}
273   */ public
274 long getNumObjectives() {
275    return libsbmlJNI.ListOfObjectives_getNumObjectives(swigCPtr, this);
276  }
277
278  
279/**
280   * Creates a new {@link Objective} object, adds it to the
281   * {@link ListOfObjectives} and returns the {@link Objective} object created. 
282   <p>
283   * @return a new {@link Objective} object instance
284   <p>
285   * @see #addObjective(Objective o)
286   */ public
287 Objective createObjective() {
288    long cPtr = libsbmlJNI.ListOfObjectives_createObjective(swigCPtr, this);
289    return (cPtr == 0) ? null : new Objective(cPtr, false);
290  }
291
292  
293/**
294   * Removes the nth {@link Objective} from this {@link ListOfObjectives}
295   * and returns a pointer to it.
296   <p>
297   * The caller owns the returned item and is responsible for deleting it.
298   <p>
299   * @param n the index of the {@link Objective} to remove.
300   <p>
301   * @see #size()
302   */ public
303 Objective remove(long n) {
304    long cPtr = libsbmlJNI.ListOfObjectives_remove__SWIG_0(swigCPtr, this, n);
305    return (cPtr == 0) ? null : new Objective(cPtr, true);
306  }
307
308  
309/**
310   * Removes the {@link Objective} from this {@link ListOfObjectives} with the given identifier
311   * and returns a pointer to it.
312   <p>
313   * The caller owns the returned item and is responsible for deleting it.
314   * If none of the items in this list have the identifier <code>sid</code>, then
315   * <code>null</code> is returned.
316   <p>
317   * @param sid the identifier of the {@link Objective} to remove.
318   <p>
319   * @return the {@link Objective} removed. As mentioned above, the caller owns the
320   * returned item.
321   */ public
322 Objective remove(String sid) {
323    long cPtr = libsbmlJNI.ListOfObjectives_remove__SWIG_1(swigCPtr, this, sid);
324    return (cPtr == 0) ? null : new Objective(cPtr, true);
325  }
326
327  
328/**
329   * Returns the XML element name of this object.
330   <p>
331   * For {@link ListOfObjectives}, the XML element name is always <code>'listOfObjectives'.</code>
332   <p>
333   * @return the name of this element, i.e. <code>'listOfObjectives'.</code>
334   */ public
335 String getElementName() {
336    return libsbmlJNI.ListOfObjectives_getElementName(swigCPtr, this);
337  }
338
339  
340/**
341  * Predicate returning <code>true</code> if this ListOfObjective's 'activeObjective'
342  * attribute is set.
343  <p>
344  * @return <code>true</code> if this ListOfObjective's 'activeObjective' attribute has been set,
345  * otherwise <code>false</code> is returned.
346  */ public
347 boolean isSetActiveObjective() {
348    return libsbmlJNI.ListOfObjectives_isSetActiveObjective(swigCPtr, this);
349  }
350
351  
352/**
353  * Sets the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
354  <p>
355  * <p>
356 * @return integer value indicating success/failure of the
357 * function.   The possible values
358 * returned by this function are:
359  * <ul>
360  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
361  * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
362  * </ul>
363  */ public
364 int setActiveObjective(String activeObjective) {
365    return libsbmlJNI.ListOfObjectives_setActiveObjective(swigCPtr, this, activeObjective);
366  }
367
368  
369/**
370  * Returns the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
371  <p>
372  * @return the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
373  */ public
374 String getActiveObjective() {
375    return libsbmlJNI.ListOfObjectives_getActiveObjective(swigCPtr, this);
376  }
377
378  
379/**
380  * Unsets the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
381  <p>
382  * <p>
383 * @return integer value indicating success/failure of the
384 * function.   The possible values
385 * returned by this function are:
386  * <ul>
387  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
388  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
389  * </ul>
390  */ public
391 int unsetActiveObjective() {
392    return libsbmlJNI.ListOfObjectives_unsetActiveObjective(swigCPtr, this);
393  }
394
395  
396/**
397   * Returns the libSBML type code for this SBML object.
398   <p>
399   * <p>
400 * LibSBML attaches an identifying code to every kind of SBML object.  These
401 * are integer constants known as <em>SBML type codes</em>.  The names of all
402 * the codes begin with the characters <code>SBML_</code>.
403 * In the Java language interface for libSBML, the
404 * type codes are defined as static integer constants in the interface class
405 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
406 * package plug-ins may use overlapping type codes; to identify the package
407 * to which a given object belongs, call the <code>getPackageName()</code>
408 * method on the object.
409   <p>
410   * @return the SBML type code for this object:
411   * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} (default).
412   <p>
413   * <p>
414 * @warning <span class='warning'>The specific integer values of the possible
415 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
416 * packages,  To fully identify the correct code, <strong>it is necessary to
417 * invoke both getTypeCode() and getPackageName()</strong>.</span>
418   <p>
419   * @see #getElementName()
420   * @see #getPackageName()
421   */ public
422 int getTypeCode() {
423    return libsbmlJNI.ListOfObjectives_getTypeCode(swigCPtr, this);
424  }
425
426  
427/**
428   * Returns the libSBML type code for the objects contained in this {@link ListOf}.
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 <code>getPackageName()</code>
439 * method on the object.
440   <p>
441   * @return the SBML type code for the objects contained in this {@link ListOf}
442   * instance: {@link libsbmlConstants#SBML_FBC_OBJECTIVE SBML_FBC_OBJECTIVE} (default).
443   <p>
444   * @see #getElementName()
445   * @see #getPackageName()
446   */ public
447 int getItemTypeCode() {
448    return libsbmlJNI.ListOfObjectives_getItemTypeCode(swigCPtr, this);
449  }
450
451  
452/**
453  * Adds a clone of all items in the provided {@link ListOf} to this object.
454  <p>
455  * This means that when this {@link ListOf} is destroyed, the original items will
456  * not be destroyed.  In addition, copy over the input {@link ListOfObjectives}'
457  * 'activeObjective' attribute, if none is set for this element.
458  <p>
459  * @param list A list of items to be added.
460  <p>
461  * @see #append(SBase item)
462  */ public
463 int appendFrom(ListOf list) {
464    return libsbmlJNI.ListOfObjectives_appendFrom(swigCPtr, this, ListOf.getCPtr(list), list);
465  }
466
467  
468/**
469  * <p>
470 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
471 * value.
472 <p>
473 * <p>
474 * In SBML, object identifiers are of a data type called <code>SId</code>.
475 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
476 * introduced for attribute values that refer to <code>SId</code> values; in
477 * previous Levels of SBML, this data type did not exist and attributes were
478 * simply described to as 'referring to an identifier', but the effective
479 * data type was the same as <code>SIdRef</code>in Level&nbsp;3.  These and
480 * other methods of libSBML refer to the type <code>SIdRef</code> for all
481 * Levels of SBML, even if the corresponding SBML specification did not
482 * explicitly name the data type.
483 <p>
484 * This method works by looking at all attributes and (if appropriate)
485 * mathematical formulas in MathML content, comparing the referenced
486 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
487 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
488 * descend into child elements.
489 <p>
490 * @param oldid the old identifier
491 * @param newid the new identifier
492  */ public
493 void renameSIdRefs(String oldid, String newid) {
494    libsbmlJNI.ListOfObjectives_renameSIdRefs(swigCPtr, this, oldid, newid);
495  }
496
497}