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 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   */ public
113 ListOfFbcAssociations(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
114    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_0(level, version, pkgVersion), true);
115  }
116
117  
118/**
119   * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version,
120   * and &ldquo;fbc&rdquo;package version.
121   <p>
122   * @param level a long integer, the SBML Level to assign to this
123   * {@link ListOfFbcAssociations}
124   <p>
125   * @param version a long integer, the SBML Version to assign to this
126   * {@link ListOfFbcAssociations}
127   <p>
128   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
129   * Version to assign to this {@link ListOfFbcAssociations}
130   */ public
131 ListOfFbcAssociations(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
132    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_1(level, version), true);
133  }
134
135  
136/**
137   * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version,
138   * and &ldquo;fbc&rdquo;package version.
139   <p>
140   * @param level a long integer, the SBML Level to assign to this
141   * {@link ListOfFbcAssociations}
142   <p>
143   * @param version a long integer, the SBML Version to assign to this
144   * {@link ListOfFbcAssociations}
145   <p>
146   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
147   * Version to assign to this {@link ListOfFbcAssociations}
148   */ public
149 ListOfFbcAssociations(long level) throws org.sbml.libsbml.SBMLConstructorException {
150    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_2(level), true);
151  }
152
153  
154/**
155   * Creates a new {@link ListOfFbcAssociations} with the given SBML Level, Version,
156   * and &ldquo;fbc&rdquo;package version.
157   <p>
158   * @param level a long integer, the SBML Level to assign to this
159   * {@link ListOfFbcAssociations}
160   <p>
161   * @param version a long integer, the SBML Version to assign to this
162   * {@link ListOfFbcAssociations}
163   <p>
164   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
165   * Version to assign to this {@link ListOfFbcAssociations}
166   */ public
167 ListOfFbcAssociations() throws org.sbml.libsbml.SBMLConstructorException {
168    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_3(), true);
169  }
170
171  
172/**
173   * Creates a new {@link ListOfFbcAssociations} with the given {@link FbcPkgNamespaces}
174   * object.
175   <p>
176   * @param fbcns the {@link FbcPkgNamespaces} object
177   */ public
178 ListOfFbcAssociations(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
179    this(libsbmlJNI.new_ListOfFbcAssociations__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
180  }
181
182  
183/**
184   * Creates and returns a deep copy of this {@link ListOfFbcAssociations} object.
185   <p>
186   * @return a (deep) copy of this {@link ListOfFbcAssociations} object.
187   */ public
188 ListOfFbcAssociations cloneObject() {
189    long cPtr = libsbmlJNI.ListOfFbcAssociations_cloneObject(swigCPtr, this);
190    return (cPtr == 0) ? null : new ListOfFbcAssociations(cPtr, true);
191  }
192
193  
194/**
195   * Get a {@link FbcAssociation} from the {@link ListOfFbcAssociations}.
196   <p>
197   * @param n the index number of the {@link FbcAssociation} to get.
198   <p>
199   * @return the nth {@link FbcAssociation} in this {@link ListOfFbcAssociations}.
200   <p>
201   * @see #size()
202   * @see #getNumFbcAssociations()
203   */ public
204 FbcAssociation get(long n) {
205    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_get__SWIG_0(swigCPtr, this, n), false);
206}
207
208  
209/**
210   * Get a {@link FbcAssociation} from the {@link ListOfFbcAssociations} based on its
211   * identifier.
212   <p>
213   * @param sid a string representing the identifier of the {@link FbcAssociation} to
214   * get.
215   <p>
216   * @return {@link FbcAssociation} in this {@link ListOfFbcAssociations} with the given id
217   * or null if no such {@link FbcAssociation} exists.
218   <p>
219   * @see #get(long n)
220   * @see #size()
221   */ public
222 FbcAssociation get(String sid) {
223    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_get__SWIG_2(swigCPtr, this, sid), false);
224}
225
226  
227/**
228   * Adds a copy the given {@link FbcAssociation} object to this
229   * {@link ListOfFbcAssociations}.
230   <p>
231   * @param fa; the {@link FbcAssociation} object to add
232   <p>
233   * @return integer value indicating success/failure of the
234   * function.   The possible values
235   * returned by this function are:
236   * <ul>
237   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
238   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
239   * </ul>
240   */ public
241 int addFbcAssociation(FbcAssociation fa) {
242    return libsbmlJNI.ListOfFbcAssociations_addFbcAssociation(swigCPtr, this, FbcAssociation.getCPtr(fa), fa);
243  }
244
245  
246/**
247   * Get the number of {@link FbcAssociation} objects in this {@link ListOfFbcAssociations}.
248   <p>
249   * @return the number of {@link FbcAssociation} objects in this
250   * {@link ListOfFbcAssociations}
251   */ public
252 long getNumFbcAssociations() {
253    return libsbmlJNI.ListOfFbcAssociations_getNumFbcAssociations(swigCPtr, this);
254  }
255
256  
257/**
258   * Creates a new {@link FbcAnd} object.
259   <p>
260   * This method creates a new {@link FbcAssociation} object of subclass {@link FbcAnd}, adds
261   * it to the {@link ListOfFbcAssociations}, and returns the {@link FbcAssociation} object
262   * created.
263   <p>
264   * @return a new {@link FbcAssociation} object instance
265   <p>
266   * @see #createOr()
267   * @see #createGeneProductRef()
268   * @see #addFbcAssociation(FbcAssociation fa)
269   */ public
270 FbcAnd createAnd() {
271    long cPtr = libsbmlJNI.ListOfFbcAssociations_createAnd(swigCPtr, this);
272    return (cPtr == 0) ? null : new FbcAnd(cPtr, false);
273  }
274
275  
276/**
277   * Creates a new {@link FbcOr} object.
278   <p>
279   * This method creates a new {@link FbcAssociation} object of subclass {@link FbcOr}, adds
280   * it to the {@link ListOfFbcAssociations}, and returns the {@link FbcAssociation} object
281   * created.
282   <p>
283   * @return a new {@link FbcAssociation} object instance
284   <p>
285   * @see #createAnd()
286   * @see #createGeneProductRef()
287   * @see #addFbcAssociation(FbcAssociation fa)
288   */ public
289 FbcOr createOr() {
290    long cPtr = libsbmlJNI.ListOfFbcAssociations_createOr(swigCPtr, this);
291    return (cPtr == 0) ? null : new FbcOr(cPtr, false);
292  }
293
294  
295/**
296   * Creates a new {@link GeneProductRef} object.
297   <p>
298   * This method creates a new {@link FbcAssociation} object of subclass
299   * {@link GeneProductRef}, adds it to the {@link ListOfFbcAssociations}, and returns the
300   * {@link FbcAssociation} object created.
301   <p>
302   * @return a new {@link FbcAssociation} object instance
303   <p>
304   * @see #createOr()
305   * @see #createAnd()
306   * @see #addFbcAssociation(FbcAssociation fa)
307   */ public
308 GeneProductRef createGeneProductRef() {
309    long cPtr = libsbmlJNI.ListOfFbcAssociations_createGeneProductRef(swigCPtr, this);
310    return (cPtr == 0) ? null : new GeneProductRef(cPtr, false);
311  }
312
313  
314/**
315   * Removes the nth {@link FbcAssociation}
316   <p>
317   * This method removes the nth object from this {@link ListOfFbcAssociations} and
318   * returns a pointer to it.
319   <p>
320   * @param n the index of the {@link FbcAssociation} to remove.
321   <p>
322   * @see #size()
323   */ public
324 FbcAssociation remove(long n) {
325    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_remove__SWIG_0(swigCPtr, this, n), true);
326}
327
328  
329/**
330   * Removes the {@link FbcAssociation} with the given identifier
331   <p>
332   * This method searches for and removes the {@link FbcAssociation} object with the
333   * given identifier <code>sid</code>, and returns a pointer to it.  The caller owns
334   * the returned item and is responsible for deleting it.  If none of the
335   * items in this list have the identifier <code>sid</code>, then <code>null</code> is returned.
336   <p>
337   * @param sid the identifier of the {@link FbcAssociation} to remove.
338   <p>
339   * @return the {@link FbcAssociation} removed. As mentioned above, the caller owns
340   * the returned item.
341   */ public
342 FbcAssociation remove(String sid) {
343    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.ListOfFbcAssociations_remove__SWIG_1(swigCPtr, this, sid), true);
344}
345
346  
347/**
348   * Returns the XML element name of this object.
349   <p>
350   * For {@link ListOfFbcAssociations}, the XML element name is always
351   * <code>'listOfFbcAssociations'.</code>
352   <p>
353   * @return the name of this element.
354   */ public
355 String getElementName() {
356    return libsbmlJNI.ListOfFbcAssociations_getElementName(swigCPtr, this);
357  }
358
359  
360/**
361   * Returns the libSBML type code for this SBML object.
362   <p>
363   * <p>
364 * LibSBML attaches an identifying code to every kind of SBML object.  These
365 * are integer constants known as <em>SBML type codes</em>.  The names of all
366 * the codes begin with the characters <code>SBML_</code>.
367 * In the Java language interface for libSBML, the
368 * type codes are defined as static integer constants in the interface class
369 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
370 * package plug-ins may use overlapping type codes; to identify the package
371 * to which a given object belongs, call the <code>getPackageName()</code>
372 * method on the object.
373   <p>
374   * @return the SBML type code for this object:
375   * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} (default).
376   <p>
377   * <p>
378 * @warning <span class='warning'>The specific integer values of the possible
379 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
380 * packages,  To fully identify the correct code, <strong>it is necessary to
381 * invoke both getTypeCode() and getPackageName()</strong>.</span>
382   <p>
383   * @see #getElementName()
384   * @see #getPackageName()
385   */ public
386 int getTypeCode() {
387    return libsbmlJNI.ListOfFbcAssociations_getTypeCode(swigCPtr, this);
388  }
389
390  
391/**
392   * Returns the libSBML type code for the objects contained in this {@link ListOf}.
393   <p>
394   * <p>
395 * LibSBML attaches an identifying code to every kind of SBML object.  These
396 * are integer constants known as <em>SBML type codes</em>.  The names of all
397 * the codes begin with the characters <code>SBML_</code>.
398 * In the Java language interface for libSBML, the
399 * type codes are defined as static integer constants in the interface class
400 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
401 * package plug-ins may use overlapping type codes; to identify the package
402 * to which a given object belongs, call the <code>getPackageName()</code>
403 * method on the object.
404   <p>
405   * @return the SBML type code for the objects contained in this {@link ListOf}
406   * instance: {@link libsbmlConstants#SBML_FBC_ASSOCIATION SBML_FBC_ASSOCIATION} (default).
407   <p>
408   * @see #getElementName()
409   * @see #getPackageName()
410   */ public
411 int getItemTypeCode() {
412    return libsbmlJNI.ListOfFbcAssociations_getItemTypeCode(swigCPtr, this);
413  }
414
415}