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 FbcAssociation} objects.
014 <p>
015 * <p style='color: #777; font-style: italic'>
016This class of objects is defined by libSBML only and has no direct
017equivalent in terms of SBML components.  This class is not prescribed by
018the SBML specifications, although it is used to implement features
019defined in SBML.
020</p>
021
022 <p>
023 * The {@link ListOfFbcAssociations} is a container of {@link FbcAssociation} objects for the
024 * {@link FbcAnd} and {@link FbcOr} classes.  Unlike the ListOf___ classes in SBML, the
025 * {@link ListOfFbcAssociations} is not a class that appears in the &ldquo;fbc&rdquo;
026 * Version&nbsp;2 specification, and instead is used internally in libSBML as
027 * a convenience class to store arbitrary numbers of {@link FbcAssociation} objects.
028 * Also unlike other ListOf___ classes, the {@link FbcAnd} and {@link FbcOr} classes require
029 * at least two child {@link FbcAssociation} objects, so valid {@link ListOfFbcAssociations}
030 * libsbml objects will always contain two or more children.  These children
031 * will have element names associated with their derived class, not the base
032 * {@link FbcAssociation} class: <code>&lt;fbc:and&gt;</code>,
033 * <code>&lt;fbc:or&gt;</code>, and <code>&lt;fbc:geneProductRef&gt;</code>.
034 <p>
035 * <p>
036 * @note This class of objects was introduced in Version&nbsp;2 of the
037 * SBML Level&nbsp;3 Flux Balance Constraints (&ldquo;fbc&rdquo;)
038 * specification.  In Version&nbsp;1 of &ldquo;fbc&rdquo;, the information
039 * encoded by this class can be stored instead using the {@link Association} and
040 * {@link GeneAssociation} annotation classes.  Please see the Version&nbsp;1 and
041 * Version&nbsp;2 &ldquo;fbc&rdquo; specifications for more details.
042 <p>
043 * @warning It is important to be clear that <em>ListOfFbcAssociations is not
044 * written out in the XML output produced by libSBML</em>&mdash;the
045 * constructs only exist in software to enable software applications to
046 * manipulate {@link FbcAssociation} objects in a way that mirrors how other lists of
047 * components in SBML are manipulated.  {@link ListOfFbcAssociations} is abstracted
048 * away when an SBML &ldquo;fbc&rdquo; model file is actually written out in
049 * the final XML form.
050 <p>
051 * @see FbcAssociation
052 * @see FbcAnd
053 * @see FbcOr
054 * @see GeneProductRef
055 */
056
057public class ListOfFbcAssociations extends ListOf {
058   private long swigCPtr;
059
060   protected ListOfFbcAssociations(long cPtr, boolean cMemoryOwn)
061   {
062     super(libsbmlJNI.ListOfFbcAssociations_SWIGUpcast(cPtr), cMemoryOwn);
063     swigCPtr = cPtr;
064   }
065
066   protected static long getCPtr(ListOfFbcAssociations obj)
067   {
068     return (obj == null) ? 0 : obj.swigCPtr;
069   }
070
071   protected static long getCPtrAndDisown (ListOfFbcAssociations obj)
072   {
073     long ptr = 0;
074
075     if (obj != null)
076     {
077       ptr             = obj.swigCPtr;
078       obj.swigCMemOwn = false;
079     }
080
081     return ptr;
082   }
083
084  protected void finalize() {
085    delete();
086  }
087
088  public synchronized void delete() {
089    if (swigCPtr != 0) {
090      if (swigCMemOwn) {
091        swigCMemOwn = false;
092        libsbmlJNI.delete_ListOfFbcAssociations(swigCPtr);
093      }
094      swigCPtr = 0;
095    }
096    super.delete();
097  }
098
099  
100/**
101   * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version,
102   * and &ldquo;fbc&rdquo;package version.
103   <p>
104   * @param level a long integer, the SBML Level to assign to this
105   * {@link ListOfFbcAssociations}.
106   <p>
107   * @param version a long integer, the SBML Version to assign to this
108   * {@link ListOfFbcAssociations}.
109   <p>
110   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
111   * Version to assign to this {@link ListOfFbcAssociations}.
112   <p>
113   * <p>
114 * @note Attempting to add an object to an {@link SBMLDocument} having a different
115 * combination of SBML Level, Version and XML namespaces than the object
116 * itself will result in an error at the time a caller attempts to make the
117 * addition.  A parent object must have compatible Level, Version and XML
118 * namespaces.  (Strictly speaking, a parent may also have more XML
119 * namespaces than a child, but the reverse is not permitted.)  The
120 * restriction is necessary to ensure that an SBML model has a consistent
121 * overall structure.  This requires callers to manage their objects
122 * carefully, but the benefit is increased flexibility in how models can be
123 * created by permitting callers to create objects bottom-up if desired.  In
124 * situations where objects are not yet attached to parents (e.g.,
125 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
126 * libSBML determine such things as whether it is valid to assign a
127 * particular value to an attribute.  For packages, this means that the 
128 * parent object to which this package element is being added must have
129 * been created with the package namespace, or that the package namespace
130 * was added to it, even if that parent is not a package object itself.
131   */ public
132 ListOfFbcAssociations(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
133    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_0(level, version, pkgVersion), true);
134  }
135
136  
137/**
138   * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version,
139   * and &ldquo;fbc&rdquo;package version.
140   <p>
141   * @param level a long integer, the SBML Level to assign to this
142   * {@link ListOfFbcAssociations}.
143   <p>
144   * @param version a long integer, the SBML Version to assign to this
145   * {@link ListOfFbcAssociations}.
146   <p>
147   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
148   * Version to assign to this {@link ListOfFbcAssociations}.
149   <p>
150   * <p>
151 * @note Attempting to add an object to an {@link SBMLDocument} having a different
152 * combination of SBML Level, Version and XML namespaces than the object
153 * itself will result in an error at the time a caller attempts to make the
154 * addition.  A parent object must have compatible Level, Version and XML
155 * namespaces.  (Strictly speaking, a parent may also have more XML
156 * namespaces than a child, but the reverse is not permitted.)  The
157 * restriction is necessary to ensure that an SBML model has a consistent
158 * overall structure.  This requires callers to manage their objects
159 * carefully, but the benefit is increased flexibility in how models can be
160 * created by permitting callers to create objects bottom-up if desired.  In
161 * situations where objects are not yet attached to parents (e.g.,
162 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
163 * libSBML determine such things as whether it is valid to assign a
164 * particular value to an attribute.  For packages, this means that the 
165 * parent object to which this package element is being added must have
166 * been created with the package namespace, or that the package namespace
167 * was added to it, even if that parent is not a package object itself.
168   */ public
169 ListOfFbcAssociations(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
170    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_1(level, version), true);
171  }
172
173  
174/**
175   * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version,
176   * and &ldquo;fbc&rdquo;package version.
177   <p>
178   * @param level a long integer, the SBML Level to assign to this
179   * {@link ListOfFbcAssociations}.
180   <p>
181   * @param version a long integer, the SBML Version to assign to this
182   * {@link ListOfFbcAssociations}.
183   <p>
184   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
185   * Version to assign to this {@link ListOfFbcAssociations}.
186   <p>
187   * <p>
188 * @note Attempting to add an object to an {@link SBMLDocument} having a different
189 * combination of SBML Level, Version and XML namespaces than the object
190 * itself will result in an error at the time a caller attempts to make the
191 * addition.  A parent object must have compatible Level, Version and XML
192 * namespaces.  (Strictly speaking, a parent may also have more XML
193 * namespaces than a child, but the reverse is not permitted.)  The
194 * restriction is necessary to ensure that an SBML model has a consistent
195 * overall structure.  This requires callers to manage their objects
196 * carefully, but the benefit is increased flexibility in how models can be
197 * created by permitting callers to create objects bottom-up if desired.  In
198 * situations where objects are not yet attached to parents (e.g.,
199 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
200 * libSBML determine such things as whether it is valid to assign a
201 * particular value to an attribute.  For packages, this means that the 
202 * parent object to which this package element is being added must have
203 * been created with the package namespace, or that the package namespace
204 * was added to it, even if that parent is not a package object itself.
205   */ public
206 ListOfFbcAssociations(long level) throws org.sbml.libsbml.SBMLConstructorException {
207    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_2(level), true);
208  }
209
210  
211/**
212   * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version,
213   * and &ldquo;fbc&rdquo;package version.
214   <p>
215   * @param level a long integer, the SBML Level to assign to this
216   * {@link ListOfFbcAssociations}.
217   <p>
218   * @param version a long integer, the SBML Version to assign to this
219   * {@link ListOfFbcAssociations}.
220   <p>
221   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
222   * Version to assign to this {@link ListOfFbcAssociations}.
223   <p>
224   * <p>
225 * @note Attempting to add an object to an {@link SBMLDocument} having a different
226 * combination of SBML Level, Version and XML namespaces than the object
227 * itself will result in an error at the time a caller attempts to make the
228 * addition.  A parent object must have compatible Level, Version and XML
229 * namespaces.  (Strictly speaking, a parent may also have more XML
230 * namespaces than a child, but the reverse is not permitted.)  The
231 * restriction is necessary to ensure that an SBML model has a consistent
232 * overall structure.  This requires callers to manage their objects
233 * carefully, but the benefit is increased flexibility in how models can be
234 * created by permitting callers to create objects bottom-up if desired.  In
235 * situations where objects are not yet attached to parents (e.g.,
236 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
237 * libSBML determine such things as whether it is valid to assign a
238 * particular value to an attribute.  For packages, this means that the 
239 * parent object to which this package element is being added must have
240 * been created with the package namespace, or that the package namespace
241 * was added to it, even if that parent is not a package object itself.
242   */ public
243 ListOfFbcAssociations() throws org.sbml.libsbml.SBMLConstructorException {
244    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_3(), true);
245  }
246
247  
248/**
249   * Creates a new {@link ListOfFbcAssociations} with the given {@link FbcPkgNamespaces}
250   * object.
251   <p>
252   * <p>
253 * The package namespaces object used in this constructor is derived from a
254 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
255 * information.  It is used to communicate the SBML Level, Version, and 
256 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
257 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
258 * package namespace object somewhere in a program once, then hand that object
259 * as needed to object constructors of that package that accept it as and
260 * argument, such as this one.
261   <p>
262   * @param fbcns the {@link FbcPkgNamespaces} object.
263   <p>
264   * <p>
265 * @note Attempting to add an object to an {@link SBMLDocument} having a different
266 * combination of SBML Level, Version and XML namespaces than the object
267 * itself will result in an error at the time a caller attempts to make the
268 * addition.  A parent object must have compatible Level, Version and XML
269 * namespaces.  (Strictly speaking, a parent may also have more XML
270 * namespaces than a child, but the reverse is not permitted.)  The
271 * restriction is necessary to ensure that an SBML model has a consistent
272 * overall structure.  This requires callers to manage their objects
273 * carefully, but the benefit is increased flexibility in how models can be
274 * created by permitting callers to create objects bottom-up if desired.  In
275 * situations where objects are not yet attached to parents (e.g.,
276 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
277 * libSBML determine such things as whether it is valid to assign a
278 * particular value to an attribute.  For packages, this means that the 
279 * parent object to which this package element is being added must have
280 * been created with the package namespace, or that the package namespace
281 * was added to it, even if that parent is not a package object itself.
282   */ public
283 ListOfFbcAssociations(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
284    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
285  }
286
287  
288/**
289   * Creates and returns a deep copy of this {@link ListOfFbcAssociations} object.
290   <p>
291   * @return a (deep) copy of this {@link ListOfFbcAssociations} object.
292   */ public
293 ListOfFbcAssociations cloneObject() {
294    long cPtr = libsbmlJNI.ListOfFbcAssociations_cloneObject(swigCPtr, this);
295    return (cPtr == 0) ? null : new ListOfFbcAssociations(cPtr, true);
296  }
297
298  
299/**
300   * Get a {@link FbcAssociation} from the {@link ListOfFbcAssociations}.
301   <p>
302   * @param n the index number of the {@link FbcAssociation} to get.
303   <p>
304   * @return the nth {@link FbcAssociation} in this {@link ListOfFbcAssociations}.
305   <p>
306   * @see #size()
307   * @see #getNumFbcAssociations()
308   */ public
309 FbcAssociation get(long n) {
310    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_get__SWIG_0(swigCPtr, this, n), false);
311}
312
313  
314/**
315   * Get a {@link FbcAssociation} from the {@link ListOfFbcAssociations} based on its
316   * identifier.
317   <p>
318   * @param sid a string representing the identifier of the {@link FbcAssociation} to
319   * get.
320   <p>
321   * @return {@link FbcAssociation} in this {@link ListOfFbcAssociations} with the given id
322   * or <code>null</code> if no such {@link FbcAssociation} exists.
323   <p>
324   * @see #get(long n)
325   * @see #size()
326   */ public
327 FbcAssociation get(String sid) {
328    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_get__SWIG_2(swigCPtr, this, sid), false);
329}
330
331  
332/**
333   * Adds a copy the given {@link FbcAssociation} object to this
334   * {@link ListOfFbcAssociations}.
335   <p>
336   * @param fa the {@link FbcAssociation} object to add.
337   <p>
338   * <p>
339 * @return integer value indicating success/failure of the
340 * function.   The possible values
341 * returned by this function are:
342   * <ul>
343   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
344   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
345   * </ul>
346   */ public
347 int addFbcAssociation(FbcAssociation fa) {
348    return libsbmlJNI.ListOfFbcAssociations_addFbcAssociation(swigCPtr, this, FbcAssociation.getCPtr(fa), fa);
349  }
350
351  
352/**
353   * Get the number of {@link FbcAssociation} objects in this {@link ListOfFbcAssociations}.
354   <p>
355   * @return the number of {@link FbcAssociation} objects in this
356   * {@link ListOfFbcAssociations}.
357   */ public
358 long getNumFbcAssociations() {
359    return libsbmlJNI.ListOfFbcAssociations_getNumFbcAssociations(swigCPtr, this);
360  }
361
362  
363/**
364   * Creates a new {@link FbcAnd} object.
365   <p>
366   * This method creates a new {@link FbcAssociation} object of subclass {@link FbcAnd}, adds
367   * it to the {@link ListOfFbcAssociations}, and returns the {@link FbcAssociation} object
368   * created.
369   <p>
370   * @return a new {@link FbcAssociation} object instance.
371   <p>
372   * @see #createOr()
373   * @see #createGeneProductRef()
374   * @see #addFbcAssociation(FbcAssociation fa)
375   */ public
376 FbcAnd createAnd() {
377    long cPtr = libsbmlJNI.ListOfFbcAssociations_createAnd(swigCPtr, this);
378    return (cPtr == 0) ? null : new FbcAnd(cPtr, false);
379  }
380
381  
382/**
383   * Creates a new {@link FbcOr} object.
384   <p>
385   * This method creates a new {@link FbcAssociation} object of subclass {@link FbcOr}, adds
386   * it to the {@link ListOfFbcAssociations}, and returns the {@link FbcAssociation} object
387   * created.
388   <p>
389   * @return a new {@link FbcAssociation} object instance.
390   <p>
391   * @see #createAnd()
392   * @see #createGeneProductRef()
393   * @see #addFbcAssociation(FbcAssociation fa)
394   */ public
395 FbcOr createOr() {
396    long cPtr = libsbmlJNI.ListOfFbcAssociations_createOr(swigCPtr, this);
397    return (cPtr == 0) ? null : new FbcOr(cPtr, false);
398  }
399
400  
401/**
402   * Creates a new {@link GeneProductRef} object.
403   <p>
404   * This method creates a new {@link FbcAssociation} object of subclass
405   * {@link GeneProductRef}, adds it to the {@link ListOfFbcAssociations}, and returns the
406   * {@link FbcAssociation} object created.
407   <p>
408   * @return a new {@link FbcAssociation} object instance.
409   <p>
410   * @see #createOr()
411   * @see #createAnd()
412   * @see #addFbcAssociation(FbcAssociation fa)
413   */ public
414 GeneProductRef createGeneProductRef() {
415    long cPtr = libsbmlJNI.ListOfFbcAssociations_createGeneProductRef(swigCPtr, this);
416    return (cPtr == 0) ? null : new GeneProductRef(cPtr, false);
417  }
418
419  
420/**
421   * Removes the nth {@link FbcAssociation}
422   <p>
423   * This method removes the nth object from this {@link ListOfFbcAssociations} and
424   * returns a pointer to it.
425   <p>
426   * @param n the index of the {@link FbcAssociation} to remove.
427   <p>
428   * @see #size()
429   */ public
430 FbcAssociation remove(long n) {
431    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_remove__SWIG_0(swigCPtr, this, n), true);
432}
433
434  
435/**
436   * Removes the {@link FbcAssociation} with the given identifier
437   <p>
438   * This method searches for and removes the {@link FbcAssociation} object with the
439   * given identifier <code>sid</code>, and returns a pointer to it.  The caller owns
440   * the returned item and is responsible for deleting it.  If none of the
441   * items in this list have the identifier <code>sid</code>, then <code>null</code> is returned.
442   <p>
443   * @param sid the identifier of the {@link FbcAssociation} to remove.
444   <p>
445   * @return the {@link FbcAssociation} removed. As mentioned above, the caller owns
446   * the returned item.
447   */ public
448 FbcAssociation remove(String sid) {
449    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_remove__SWIG_1(swigCPtr, this, sid), true);
450}
451
452  
453/**
454   * Returns the XML element name of this object.
455   <p>
456   * For {@link ListOfFbcAssociations}, the XML element name is always
457   * <code>'listOfFbcAssociations'.</code>
458   <p>
459   * @return the name of this element.
460   */ public
461 String getElementName() {
462    return libsbmlJNI.ListOfFbcAssociations_getElementName(swigCPtr, this);
463  }
464
465  
466/**
467   * Returns the libSBML type code for this SBML object.
468   <p>
469   * <p>
470 * LibSBML attaches an identifying code to every kind of SBML object.  These
471 * are integer constants known as <em>SBML type codes</em>.  The names of all
472 * the codes begin with the characters <code>SBML_</code>.
473 * In the Java language interface for libSBML, the
474 * type codes are defined as static integer constants in the interface class
475 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
476 * package plug-ins may use overlapping type codes; to identify the package
477 * to which a given object belongs, call the 
478 * <code>{@link SBase#getPackageName()}
479 * </code>
480 * method on the object.
481   <p>
482   * @return the SBML type code for this object:
483   * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} (default).
484   <p>
485   * <p>
486 * @warning <span class='warning'>The specific integer values of the possible
487 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
488 * packages,  To fully identify the correct code, <strong>it is necessary to
489 * invoke both getTypeCode() and getPackageName()</strong>.</span>
490   <p>
491   * @see #getElementName()
492   * @see #getPackageName()
493   */ public
494 int getTypeCode() {
495    return libsbmlJNI.ListOfFbcAssociations_getTypeCode(swigCPtr, this);
496  }
497
498  
499/**
500   * Returns the libSBML type code for the objects contained in this {@link ListOf}.
501   <p>
502   * <p>
503 * LibSBML attaches an identifying code to every kind of SBML object.  These
504 * are integer constants known as <em>SBML type codes</em>.  The names of all
505 * the codes begin with the characters <code>SBML_</code>.
506 * In the Java language interface for libSBML, the
507 * type codes are defined as static integer constants in the interface class
508 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
509 * package plug-ins may use overlapping type codes; to identify the package
510 * to which a given object belongs, call the 
511 * <code>{@link SBase#getPackageName()}
512 * </code>
513 * method on the object.
514   <p>
515   * @return the SBML type code for the objects contained in this {@link ListOf}
516   * instance: {@link libsbmlConstants#SBML_FBC_ASSOCIATION SBML_FBC_ASSOCIATION} (default).
517   <p>
518   * @see #getElementName()
519   * @see #getPackageName()
520   */ public
521 int getItemTypeCode() {
522    return libsbmlJNI.ListOfFbcAssociations_getItemTypeCode(swigCPtr, this);
523  }
524
525}