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 FluxBound} objects.
014 <p>
015 * The {@link ListOfFluxBounds} is a container for the {@link FluxBound} elements of a {@link Model}.
016 * It is only defined for Version&nbsp;1 of the &ldquo;fbc&rdquo;
017 * specification, and was replaced in Version&nbsp;2 by {@link Parameter} elements
018 * referenced by the 'upperFluxBound' or 'lowerFluxBound' attributes on an
019 * {@link FbcReactionPlugin}.  {@link FluxBound} and {@link ListOfFluxBounds} are not used for
020 * Version&nbsp;2 &ldquo;fbc&rdquo; models.
021 <p>
022 * <p>
023 * The various ListOf___ classes in SBML
024 * are merely containers used for organizing the main components of an SBML
025 * model.  In libSBML's implementation, ListOf___
026 * classes are derived from the
027 * intermediate utility class {@link ListOf}, which
028 * is not defined by the SBML specifications but serves as a useful
029 * programmatic construct.  {@link ListOf} is itself is in turn derived from {@link SBase},
030 * which provides all of the various ListOf___
031 * classes with common features
032 * defined by the SBML specification, such as 'metaid' attributes and
033 * annotations.
034 <p>
035 * The relationship between the lists and the rest of an SBML model is
036 * illustrated by the following (for SBML Level&nbsp;2 Version&nbsp;4):
037 <p>
038 * <figure>
039  <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object>
040</figure>
041
042 <p>
043 * SBML Level&nbsp;3 Version&nbsp;1 has essentially the same structure as 
044 * Level&nbsp;2 Version&nbsp;4, depicted above, but SBML Level&nbsp;3 
045 * Version&nbsp;2 allows
046 * containers to contain zero or more of the relevant object, instead of 
047 * requiring at least one.  As such, libsbml will write out an 
048 * otherwise-empty ListOf___ element that has any optional attribute set 
049 * (such as 'id' or 'metaid'), that has an optional child (such 
050 * as a 'notes' or 'annotation'), or that has attributes or children set
051 * from any SBML Level&nbsp;3 package, whether or not the ListOf___ has 
052 * any other children.
053 <p>
054 * Readers may wonder about the motivations for using the ListOf___
055 * containers in SBML.  A simpler approach in XML might be to place the
056 * components all directly at the top level of the model definition.  The
057 * choice made in SBML is to group them within XML elements named after
058 * ListOf<em>Classname</em>, in part because it helps organize the
059 * components.  More importantly, the fact that the container classes are
060 * derived from {@link SBase} means that software tools can add information <em>about</em>
061 * the lists themselves into each list container's 'annotation'.
062 <p>
063 * @see ListOfFunctionDefinitions
064 * @see ListOfUnitDefinitions
065 * @see ListOfCompartmentTypes
066 * @see ListOfSpeciesTypes
067 * @see ListOfCompartments
068 * @see ListOfSpecies
069 * @see ListOfParameters
070 * @see ListOfInitialAssignments
071 * @see ListOfRules
072 * @see ListOfConstraints
073 * @see ListOfReactions
074 * @see ListOfEvents
075 <p>
076 * 
077 * @note This class and {@link FluxBound} are only defined for Version&nbsp;1 of the
078 * &ldquo;fbc&rdquo; package specification.  These classes are not used in
079 * Version&nbsp;2 of &ldquo;fbc&rdquo;.
080 <p>
081   * @see FluxBound
082 */
083
084public class ListOfFluxBounds extends ListOf {
085   private long swigCPtr;
086
087   protected ListOfFluxBounds(long cPtr, boolean cMemoryOwn)
088   {
089     super(libsbmlJNI.ListOfFluxBounds_SWIGUpcast(cPtr), cMemoryOwn);
090     swigCPtr = cPtr;
091   }
092
093   protected static long getCPtr(ListOfFluxBounds obj)
094   {
095     return (obj == null) ? 0 : obj.swigCPtr;
096   }
097
098   protected static long getCPtrAndDisown (ListOfFluxBounds obj)
099   {
100     long ptr = 0;
101
102     if (obj != null)
103     {
104       ptr             = obj.swigCPtr;
105       obj.swigCMemOwn = false;
106     }
107
108     return ptr;
109   }
110
111  protected void finalize() {
112    delete();
113  }
114
115  public synchronized void delete() {
116    if (swigCPtr != 0) {
117      if (swigCMemOwn) {
118        swigCMemOwn = false;
119        libsbmlJNI.delete_ListOfFluxBounds(swigCPtr);
120      }
121      swigCPtr = 0;
122    }
123    super.delete();
124  }
125
126  
127/**
128   * Creates and returns a deep copy of this {@link ListOfFluxBounds}.
129   <p>
130   * @return a (deep) copy of this {@link ListOfFluxBounds}.
131   */ public
132 ListOfFluxBounds cloneObject() {
133    long cPtr = libsbmlJNI.ListOfFluxBounds_cloneObject(swigCPtr, this);
134    return (cPtr == 0) ? null : new ListOfFluxBounds(cPtr, true);
135  }
136
137  
138/**
139   * Creates a new {@link ListOfFluxBounds} with the given level, version, and package version.
140   <p>
141   * @param level the SBML Level.
142   * @param version the Version within the SBML Level.
143   * @param pkgVersion the version of the package.
144   <p>
145   * <p>
146 * @note Attempting to add an object to an {@link SBMLDocument} having a different
147 * combination of SBML Level, Version and XML namespaces than the object
148 * itself will result in an error at the time a caller attempts to make the
149 * addition.  A parent object must have compatible Level, Version and XML
150 * namespaces.  (Strictly speaking, a parent may also have more XML
151 * namespaces than a child, but the reverse is not permitted.)  The
152 * restriction is necessary to ensure that an SBML model has a consistent
153 * overall structure.  This requires callers to manage their objects
154 * carefully, but the benefit is increased flexibility in how models can be
155 * created by permitting callers to create objects bottom-up if desired.  In
156 * situations where objects are not yet attached to parents (e.g.,
157 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
158 * libSBML determine such things as whether it is valid to assign a
159 * particular value to an attribute.  For packages, this means that the 
160 * parent object to which this package element is being added must have
161 * been created with the package namespace, or that the package namespace
162 * was added to it, even if that parent is not a package object itself.
163   */ public
164 ListOfFluxBounds(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
165    this(libsbmlJNI.new_ListOfFluxBounds__SWIG_0(level, version, pkgVersion), true);
166  }
167
168  
169/**
170   * Creates a new {@link ListOfFluxBounds} with the given level, version, and package version.
171   <p>
172   * @param level the SBML Level.
173   * @param version the Version within the SBML Level.
174   * @param pkgVersion the version of the package.
175   <p>
176   * <p>
177 * @note Attempting to add an object to an {@link SBMLDocument} having a different
178 * combination of SBML Level, Version and XML namespaces than the object
179 * itself will result in an error at the time a caller attempts to make the
180 * addition.  A parent object must have compatible Level, Version and XML
181 * namespaces.  (Strictly speaking, a parent may also have more XML
182 * namespaces than a child, but the reverse is not permitted.)  The
183 * restriction is necessary to ensure that an SBML model has a consistent
184 * overall structure.  This requires callers to manage their objects
185 * carefully, but the benefit is increased flexibility in how models can be
186 * created by permitting callers to create objects bottom-up if desired.  In
187 * situations where objects are not yet attached to parents (e.g.,
188 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
189 * libSBML determine such things as whether it is valid to assign a
190 * particular value to an attribute.  For packages, this means that the 
191 * parent object to which this package element is being added must have
192 * been created with the package namespace, or that the package namespace
193 * was added to it, even if that parent is not a package object itself.
194   */ public
195 ListOfFluxBounds(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
196    this(libsbmlJNI.new_ListOfFluxBounds__SWIG_1(level, version), true);
197  }
198
199  
200/**
201   * Creates a new {@link ListOfFluxBounds} with the given level, version, and package version.
202   <p>
203   * @param level the SBML Level.
204   * @param version the Version within the SBML Level.
205   * @param pkgVersion the version of the package.
206   <p>
207   * <p>
208 * @note Attempting to add an object to an {@link SBMLDocument} having a different
209 * combination of SBML Level, Version and XML namespaces than the object
210 * itself will result in an error at the time a caller attempts to make the
211 * addition.  A parent object must have compatible Level, Version and XML
212 * namespaces.  (Strictly speaking, a parent may also have more XML
213 * namespaces than a child, but the reverse is not permitted.)  The
214 * restriction is necessary to ensure that an SBML model has a consistent
215 * overall structure.  This requires callers to manage their objects
216 * carefully, but the benefit is increased flexibility in how models can be
217 * created by permitting callers to create objects bottom-up if desired.  In
218 * situations where objects are not yet attached to parents (e.g.,
219 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
220 * libSBML determine such things as whether it is valid to assign a
221 * particular value to an attribute.  For packages, this means that the 
222 * parent object to which this package element is being added must have
223 * been created with the package namespace, or that the package namespace
224 * was added to it, even if that parent is not a package object itself.
225   */ public
226 ListOfFluxBounds(long level) throws org.sbml.libsbml.SBMLConstructorException {
227    this(libsbmlJNI.new_ListOfFluxBounds__SWIG_2(level), true);
228  }
229
230  
231/**
232   * Creates a new {@link ListOfFluxBounds} with the given level, version, and package version.
233   <p>
234   * @param level the SBML Level.
235   * @param version the Version within the SBML Level.
236   * @param pkgVersion the version of the package.
237   <p>
238   * <p>
239 * @note Attempting to add an object to an {@link SBMLDocument} having a different
240 * combination of SBML Level, Version and XML namespaces than the object
241 * itself will result in an error at the time a caller attempts to make the
242 * addition.  A parent object must have compatible Level, Version and XML
243 * namespaces.  (Strictly speaking, a parent may also have more XML
244 * namespaces than a child, but the reverse is not permitted.)  The
245 * restriction is necessary to ensure that an SBML model has a consistent
246 * overall structure.  This requires callers to manage their objects
247 * carefully, but the benefit is increased flexibility in how models can be
248 * created by permitting callers to create objects bottom-up if desired.  In
249 * situations where objects are not yet attached to parents (e.g.,
250 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
251 * libSBML determine such things as whether it is valid to assign a
252 * particular value to an attribute.  For packages, this means that the 
253 * parent object to which this package element is being added must have
254 * been created with the package namespace, or that the package namespace
255 * was added to it, even if that parent is not a package object itself.
256   */ public
257 ListOfFluxBounds() throws org.sbml.libsbml.SBMLConstructorException {
258    this(libsbmlJNI.new_ListOfFluxBounds__SWIG_3(), true);
259  }
260
261  
262/**
263   * Creates a new {@link ListOfFluxBounds} with the given {@link FbcPkgNamespaces} object.
264   <p>
265   * <p>
266 * The package namespaces object used in this constructor is derived from a
267 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
268 * information.  It is used to communicate the SBML Level, Version, and 
269 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
270 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
271 * package namespace object somewhere in a program once, then hand that object
272 * as needed to object constructors of that package that accept it as and
273 * argument, such as this one.
274   <p>
275   * @param fbcns the {@link FbcPkgNamespaces} object.
276   <p>
277   * <p>
278 * @note Attempting to add an object to an {@link SBMLDocument} having a different
279 * combination of SBML Level, Version and XML namespaces than the object
280 * itself will result in an error at the time a caller attempts to make the
281 * addition.  A parent object must have compatible Level, Version and XML
282 * namespaces.  (Strictly speaking, a parent may also have more XML
283 * namespaces than a child, but the reverse is not permitted.)  The
284 * restriction is necessary to ensure that an SBML model has a consistent
285 * overall structure.  This requires callers to manage their objects
286 * carefully, but the benefit is increased flexibility in how models can be
287 * created by permitting callers to create objects bottom-up if desired.  In
288 * situations where objects are not yet attached to parents (e.g.,
289 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
290 * libSBML determine such things as whether it is valid to assign a
291 * particular value to an attribute.  For packages, this means that the 
292 * parent object to which this package element is being added must have
293 * been created with the package namespace, or that the package namespace
294 * was added to it, even if that parent is not a package object itself.
295   */ public
296 ListOfFluxBounds(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
297    this(libsbmlJNI.new_ListOfFluxBounds__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
298  }
299
300  
301/**
302   * Get a {@link FluxBound} from the {@link ListOfFluxBounds}.
303   <p>
304   * @param n the index number of the {@link FluxBound} to get.
305   <p>
306   * @return the nth {@link FluxBound} in this {@link ListOfFluxBounds}.
307   <p>
308   * @see #size()
309   */ public
310 FluxBound get(long n) {
311    long cPtr = libsbmlJNI.ListOfFluxBounds_get__SWIG_0(swigCPtr, this, n);
312    return (cPtr == 0) ? null : new FluxBound(cPtr, false);
313  }
314
315  
316/**
317   * Get a {@link FluxBound} from the {@link ListOfFluxBounds}
318   * based on its identifier.
319   <p>
320   * @param sid a string representing the identifier
321   * of the {@link FluxBound} to get.
322   <p>
323   * @return {@link FluxBound} in this {@link ListOfFluxBounds}
324   * with the given <code>sid</code> or <code>null</code> if no such
325   * {@link FluxBound} exists.
326   <p>
327   * @see #get(long n)
328   * @see #size()
329   */ public
330 FluxBound get(String sid) {
331    long cPtr = libsbmlJNI.ListOfFluxBounds_get__SWIG_2(swigCPtr, this, sid);
332    return (cPtr == 0) ? null : new FluxBound(cPtr, false);
333  }
334
335  
336/**
337   * Removes the nth item from this {@link ListOfFluxBounds} items and returns a pointer to
338   * it.
339   <p>
340   * The caller owns the returned item and is responsible for deleting it.
341   <p>
342   * @param n the index of the item to remove.
343   <p>
344   * @see #size()
345   */ public
346 FluxBound remove(long n) {
347    long cPtr = libsbmlJNI.ListOfFluxBounds_remove__SWIG_0(swigCPtr, this, n);
348    return (cPtr == 0) ? null : new FluxBound(cPtr, true);
349  }
350
351  
352/**
353   * Removes item in this {@link ListOfFluxBounds} items with the given identifier.
354   <p>
355   * The caller owns the returned item and is responsible for deleting it.
356   * If none of the items in this list have the identifier <code>sid</code>, then
357   * <code>null</code> is returned.
358   <p>
359   * @param sid the identifier of the item to remove.
360   <p>
361   * @return the item removed.  As mentioned above, the caller owns the
362   * returned item.
363   */ public
364 FluxBound remove(String sid) {
365    long cPtr = libsbmlJNI.ListOfFluxBounds_remove__SWIG_1(swigCPtr, this, sid);
366    return (cPtr == 0) ? null : new FluxBound(cPtr, true);
367  }
368
369  
370/**
371   * Returns the libSBML type code for the SBML objects
372   * contained in this {@link ListOf} object.
373   <p>
374   * <p>
375 * LibSBML attaches an identifying code to every kind of SBML object.  These
376 * are integer constants known as <em>SBML type codes</em>.  The names of all
377 * the codes begin with the characters <code>SBML_</code>.
378 * In the Java language interface for libSBML, the
379 * type codes are defined as static integer constants in the interface class
380 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
381 * package plug-ins may use overlapping type codes; to identify the package
382 * to which a given object belongs, call the 
383 * <code>{@link SBase#getPackageName()}
384 * </code>
385 * method on the object.
386   <p>
387   * @return the SBML type code for objects contained in this list:
388   * {@link libsbmlConstants#SBML_FBC_FLUXBOUND SBML_FBC_FLUXBOUND} (default).
389   <p>
390   * @see #getElementName()
391   * @see #getPackageName()
392   */ public
393 int getItemTypeCode() {
394    return libsbmlJNI.ListOfFluxBounds_getItemTypeCode(swigCPtr, this);
395  }
396
397  
398/**
399   * Returns the XML element name of this object.
400   <p>
401   * For {@link ListOfFluxBounds}, the XML element name is always <code>'listOfFluxBounds'.</code>
402   <p>
403   * @return the name of this element, i.e. <code>'listOfFluxBounds'.</code>
404   */ public
405 String getElementName() {
406    return libsbmlJNI.ListOfFluxBounds_getElementName(swigCPtr, this);
407  }
408
409}