001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 2.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 Implementation of the ListOfObjectives construct from the
014 * 'fbc' package.
015 <p>
016 * The {@link ListOfObjectives} is a container for the {@link Objective} elements of {@link Model}.
017 <p>
018 * <p>
019 * The various ListOf___ classes in SBML
020 * are merely containers used for organizing the main components of an SBML
021 * model.  In libSBML's implementation, ListOf___
022 * classes are derived from the
023 * intermediate utility class {@link ListOf}, which
024 * is not defined by the SBML specifications but serves as a useful
025 * programmatic construct.  {@link ListOf} is itself is in turn derived from {@link SBase},
026 * which provides all of the various ListOf___
027 * classes with common features
028 * defined by the SBML specification, such as 'metaid' attributes and
029 * annotations.
030 <p>
031 * The relationship between the lists and the rest of an SBML model is
032 * illustrated by the following (for SBML Level&nbsp;2 Version&nbsp;4):
033 <p>
034 * <figure>
035  <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object>
036</figure>
037
038 <p>
039 * Readers may wonder about the motivations for using the ListOf___
040 * containers in SBML.  A simpler approach in XML might be to place the
041 * components all directly at the top level of the model definition.  The
042 * choice made in SBML is to group them within XML elements named after
043 * ListOf<em>Classname</em>, in part because it helps organize the
044 * components.  More importantly, the fact that the container classes are
045 * derived from {@link SBase} means that software tools can add information <em>about</em>
046 * the lists themselves into each list container's 'annotation'.
047 <p>
048 * @see ListOfFunctionDefinitions
049 * @see ListOfUnitDefinitions
050 * @see ListOfCompartmentTypes
051 * @see ListOfSpeciesTypes
052 * @see ListOfCompartments
053 * @see ListOfSpecies
054 * @see ListOfParameters
055 * @see ListOfInitialAssignments
056 * @see ListOfRules
057 * @see ListOfConstraints
058 * @see ListOfReactions
059 * @see ListOfEvents
060 <p>
061 * @see Objective
062 */
063
064public class ListOfObjectives extends ListOf {
065   private long swigCPtr;
066
067   protected ListOfObjectives(long cPtr, boolean cMemoryOwn)
068   {
069     super(libsbmlJNI.ListOfObjectives_SWIGUpcast(cPtr), cMemoryOwn);
070     swigCPtr = cPtr;
071   }
072
073   protected static long getCPtr(ListOfObjectives obj)
074   {
075     return (obj == null) ? 0 : obj.swigCPtr;
076   }
077
078   protected static long getCPtrAndDisown (ListOfObjectives obj)
079   {
080     long ptr = 0;
081
082     if (obj != null)
083     {
084       ptr             = obj.swigCPtr;
085       obj.swigCMemOwn = false;
086     }
087
088     return ptr;
089   }
090
091  protected void finalize() {
092    delete();
093  }
094
095  public synchronized void delete() {
096    if (swigCPtr != 0) {
097      if (swigCMemOwn) {
098        swigCMemOwn = false;
099        libsbmlJNI.delete_ListOfObjectives(swigCPtr);
100      }
101      swigCPtr = 0;
102    }
103    super.delete();
104  }
105
106  
107/**
108   * Creates and returns a deep copy of this {@link ListOfObjectives} object.
109   <p>
110   * @return a (deep) copy of this {@link ListOfObjectives}.
111   */ public
112 ListOfObjectives cloneObject() {
113    long cPtr = libsbmlJNI.ListOfObjectives_cloneObject(swigCPtr, this);
114    return (cPtr == 0) ? null : new ListOfObjectives(cPtr, true);
115  }
116
117  
118/**
119   * Creates a new {@link ListOfObjectives} with the given level, version, and package version.
120   */ public
121 ListOfObjectives(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
122    this(libsbmlJNI.new_ListOfObjectives__SWIG_0(level, version, pkgVersion), true);
123  }
124
125  
126/**
127   * Creates a new {@link ListOfObjectives} with the given level, version, and package version.
128   */ public
129 ListOfObjectives(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
130    this(libsbmlJNI.new_ListOfObjectives__SWIG_1(level, version), true);
131  }
132
133  
134/**
135   * Creates a new {@link ListOfObjectives} with the given level, version, and package version.
136   */ public
137 ListOfObjectives(long level) throws org.sbml.libsbml.SBMLConstructorException {
138    this(libsbmlJNI.new_ListOfObjectives__SWIG_2(level), true);
139  }
140
141  
142/**
143   * Creates a new {@link ListOfObjectives} with the given level, version, and package version.
144   */ public
145 ListOfObjectives() throws org.sbml.libsbml.SBMLConstructorException {
146    this(libsbmlJNI.new_ListOfObjectives__SWIG_3(), true);
147  }
148
149  
150/**
151   * Creates a new {@link ListOfObjectives} with the given {@link FbcPkgNamespaces} object.
152   */ public
153 ListOfObjectives(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
154    this(libsbmlJNI.new_ListOfObjectives__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
155  }
156
157  
158/**
159   * Get a {@link Objective} from the {@link ListOfObjectives}.
160   <p>
161   * @param n the index number of the {@link Objective} to get.
162   <p>
163   * @return the nth {@link Objective} in this {@link ListOfObjectives}.
164   <p>
165   * @see #size()
166   */ public
167 Objective get(long n) {
168    long cPtr = libsbmlJNI.ListOfObjectives_get__SWIG_0(swigCPtr, this, n);
169    return (cPtr == 0) ? null : new Objective(cPtr, false);
170  }
171
172  
173/**
174   * Get a {@link Objective} from the {@link ListOfObjectives}
175   * based on its identifier.
176   <p>
177   * @param sid a string representing the identifier 
178   * of the {@link Objective} to get.
179   <p>
180   * @return {@link Objective} in this {@link ListOfObjectives}
181   * with the given <code>sid</code> or <code>null</code> if no such
182   * {@link Objective} exists.
183   <p>
184   * @see #get(long n)
185   * @see #size()
186   */ public
187 Objective get(String sid) {
188    long cPtr = libsbmlJNI.ListOfObjectives_get__SWIG_2(swigCPtr, this, sid);
189    return (cPtr == 0) ? null : new Objective(cPtr, false);
190  }
191
192  
193/**
194   * Removes the nth item from this {@link ListOfObjectives} items and returns a pointer to
195   * it.
196   <p>
197   * The caller owns the returned item and is responsible for deleting it.
198   <p>
199   * @param n the index of the item to remove
200   * @return the item removed.  As mentioned above, the caller owns the
201   * returned item.
202   <p>
203   * @see #size()
204   */ public
205 Objective remove(long n) {
206    long cPtr = libsbmlJNI.ListOfObjectives_remove__SWIG_0(swigCPtr, this, n);
207    return (cPtr == 0) ? null : new Objective(cPtr, true);
208  }
209
210  
211/**
212   * Removes item in this {@link ListOfObjectives} items with the given identifier.
213   <p>
214   * The caller owns the returned item and is responsible for deleting it.
215   * If none of the items in this list have the identifier <code>sid</code>, then @c
216   * null is returned.
217   <p>
218   * @param sid the identifier of the item to remove
219   <p>
220   * @return the item removed.  As mentioned above, the caller owns the
221   * returned item.
222   */ public
223 Objective remove(String sid) {
224    long cPtr = libsbmlJNI.ListOfObjectives_remove__SWIG_1(swigCPtr, this, sid);
225    return (cPtr == 0) ? null : new Objective(cPtr, true);
226  }
227
228  
229/**
230   * Returns the libSBML type code for the objects contained in this {@link ListOf}
231   * (i.e., {@link  libsbmlConstants#SBML_FBC_OBJECTIVE SBML_FBC_OBJECTIVE}).
232   <p>
233   * <p>
234 * LibSBML attaches an identifying code to every kind of SBML object.  These
235 * are integer constants known as <em>SBML type codes</em>.  The names of all
236 * the codes begin with the characters &ldquo;<code>SBML_</code>&rdquo;. 
237 * In the Java language interface for libSBML, the
238 * type codes are defined as static integer constants in the interface class
239 * {@link libsbmlConstants}.    Note that different Level&nbsp;3 
240 * package plug-ins may use overlapping type codes; to identify the package
241 * to which a given object belongs, call the <code>getPackageName()</code>
242 * method on the object.
243   <p>
244   * @return the SBML type code for objects contained in this list:
245   * {@link  libsbmlConstants#SBML_FBC_OBJECTIVE SBML_FBC_OBJECTIVE}
246   <p>
247   * @see #getElementName()
248   * @see #getPackageName()
249   */ public
250 int getItemTypeCode() {
251    return libsbmlJNI.ListOfObjectives_getItemTypeCode(swigCPtr, this);
252  }
253
254  
255/**
256   * Returns the XML element name of
257   * this SBML object.
258   <p>
259   * @return the string of the name of this element.
260   */ public
261 String getElementName() {
262    return libsbmlJNI.ListOfObjectives_getElementName(swigCPtr, this);
263  }
264
265  
266/**
267   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
268   * ListOfObjective's 'activeObjective' attribute has been set.
269   <p>
270   * @return <code>true</code> if this ListOfObjective's 'activeObjective' attribute has been set, 
271   * otherwise <code>false</code> is returned.
272   */ public
273 boolean isSetActiveObjective() {
274    return libsbmlJNI.ListOfObjectives_isSetActiveObjective(swigCPtr, this);
275  }
276
277  
278/**
279   * Sets the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
280   <p>
281   * @return integer value indicating success/failure of the
282   * operation. The possible return values are:
283   * <ul>
284   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
285   * <li> {@link  libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }
286   * </ul>
287   */ public
288 int setActiveObjective(String activeObjective) {
289    return libsbmlJNI.ListOfObjectives_setActiveObjective(swigCPtr, this, activeObjective);
290  }
291
292  
293/**
294   * Returns the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
295   <p>
296   * @return the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
297   */ public
298 String getActiveObjective() {
299    return libsbmlJNI.ListOfObjectives_getActiveObjective(swigCPtr, this);
300  }
301
302  
303/**
304   * Unsets the value of the 'activeObjective' attribute of this {@link ListOfObjectives}.
305   <p>
306   * @return integer value indicating success/failure of the
307   * operation. The possible return values are:
308   * <ul>
309   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS }
310   * <li> {@link  libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED }
311   * </ul>
312   */ public
313 int unsetActiveObjective() {
314    return libsbmlJNI.ListOfObjectives_unsetActiveObjective(swigCPtr, this);
315  }
316
317  
318/**
319   * Adds a clone of all items in the provided {@link ListOf} to this object.  This means that when this {@link ListOf} is destroyed, the original items will not be destroyed.  In addition, copy over the input {@link ListOfObjectives}' 'activeObjective' attribute, if none is set for this element.
320   <p>
321   * @param list A list of items to be added.
322   <p>
323   * @see #append(SBase item)
324   */ public
325 int appendFrom(ListOf list) {
326    return libsbmlJNI.ListOfObjectives_appendFrom(swigCPtr, this, ListOf.getCPtr(list), list);
327  }
328
329  
330/**
331   * Renames all the SIdRef attributes on this element if they match
332   * <code>oldid</code>, but not any found in child or plugin elements.
333   */ public
334 void renameSIdRefs(String oldid, String newid) {
335    libsbmlJNI.ListOfObjectives_renameSIdRefs(swigCPtr, this, oldid, newid);
336  }
337
338}