001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.8
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 An &ldquo;or&rdquo; relationship for gene products
014 <p>
015 * {@link FbcOr} class is used in Version 2 of the SBML Level&nbsp;3 Flux Balance
016 * Constraints (&ldquo;fbc&rdquo;) package to represent an 'or' relationship
017 * between two or more child {@link FbcAssociation} objects.  In other words, it
018 * indicates that all of the child objects are included.  Note that since the
019 * {@link FbcAssociation} class is the parent class of GeneProducRef, {@link FbcOr} and
020 * {@link FbcOr}, a given {@link FbcOr} can potentially include nested 'and'/'or'
021 * combinations of gene products.
022 <p>
023 * <p>
024 * @note This class of objects was introduced in Version&nbsp;2 of the
025 * SBML Level&nbsp;3 Flux Balance Constraints (&ldquo;fbc&rdquo;)
026 * specification.  In Version&nbsp;1 of &ldquo;fbc&rdquo;, the information
027 * encoded by this class can be stored instead using the {@link Association} and
028 * {@link GeneAssociation} annotation classes.  Please see the Version&nbsp;1 and
029 * Version&nbsp;2 &ldquo;fbc&rdquo; specifications for more details.
030 */
031
032public class FbcOr extends FbcAssociation {
033   private long swigCPtr;
034
035   protected FbcOr(long cPtr, boolean cMemoryOwn)
036   {
037     super(libsbmlJNI.FbcOr_SWIGUpcast(cPtr), cMemoryOwn);
038     swigCPtr = cPtr;
039   }
040
041   protected static long getCPtr(FbcOr obj)
042   {
043     return (obj == null) ? 0 : obj.swigCPtr;
044   }
045
046   protected static long getCPtrAndDisown (FbcOr obj)
047   {
048     long ptr = 0;
049
050     if (obj != null)
051     {
052       ptr             = obj.swigCPtr;
053       obj.swigCMemOwn = false;
054     }
055
056     return ptr;
057   }
058
059  protected void finalize() {
060    delete();
061  }
062
063  public synchronized void delete() {
064    if (swigCPtr != 0) {
065      if (swigCMemOwn) {
066        swigCMemOwn = false;
067        libsbmlJNI.delete_FbcOr(swigCPtr);
068      }
069      swigCPtr = 0;
070    }
071    super.delete();
072  }
073
074  
075/**
076   * Creates a new {@link FbcOr} with the given SBML Level, Version, and
077   * &ldquo;fbc&rdquo;package version.
078   <p>
079   * @param level a long integer, the SBML Level to assign to this {@link FbcOr}
080   <p>
081   * @param version a long integer, the SBML Version to assign to this {@link FbcOr}
082   <p>
083   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
084   * this {@link FbcOr}
085   */ public
086 FbcOr(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
087    this(libsbmlJNI.new_FbcOr__SWIG_0(level, version, pkgVersion), true);
088  }
089
090  
091/**
092   * Creates a new {@link FbcOr} with the given SBML Level, Version, and
093   * &ldquo;fbc&rdquo;package version.
094   <p>
095   * @param level a long integer, the SBML Level to assign to this {@link FbcOr}
096   <p>
097   * @param version a long integer, the SBML Version to assign to this {@link FbcOr}
098   <p>
099   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
100   * this {@link FbcOr}
101   */ public
102 FbcOr(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
103    this(libsbmlJNI.new_FbcOr__SWIG_1(level, version), true);
104  }
105
106  
107/**
108   * Creates a new {@link FbcOr} with the given SBML Level, Version, and
109   * &ldquo;fbc&rdquo;package version.
110   <p>
111   * @param level a long integer, the SBML Level to assign to this {@link FbcOr}
112   <p>
113   * @param version a long integer, the SBML Version to assign to this {@link FbcOr}
114   <p>
115   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
116   * this {@link FbcOr}
117   */ public
118 FbcOr(long level) throws org.sbml.libsbml.SBMLConstructorException {
119    this(libsbmlJNI.new_FbcOr__SWIG_2(level), true);
120  }
121
122  
123/**
124   * Creates a new {@link FbcOr} with the given SBML Level, Version, and
125   * &ldquo;fbc&rdquo;package version.
126   <p>
127   * @param level a long integer, the SBML Level to assign to this {@link FbcOr}
128   <p>
129   * @param version a long integer, the SBML Version to assign to this {@link FbcOr}
130   <p>
131   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
132   * this {@link FbcOr}
133   */ public
134 FbcOr() throws org.sbml.libsbml.SBMLConstructorException {
135    this(libsbmlJNI.new_FbcOr__SWIG_3(), true);
136  }
137
138  
139/**
140   * Creates a new {@link FbcOr} with the given {@link FbcPkgNamespaces} object.
141   <p>
142   * @param fbcns the {@link FbcPkgNamespaces} object
143   */ public
144 FbcOr(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
145    this(libsbmlJNI.new_FbcOr__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
146  }
147
148  
149/**
150   * Copy constructor for {@link FbcOr}.
151   <p>
152   * @param orig; the {@link FbcOr} instance to copy.
153   */ public
154 FbcOr(FbcOr orig) throws org.sbml.libsbml.SBMLConstructorException {
155    this(libsbmlJNI.new_FbcOr__SWIG_5(FbcOr.getCPtr(orig), orig), true);
156  }
157
158  
159/**
160   * Creates and returns a deep copy of this {@link FbcOr} object.
161   <p>
162   * @return a (deep) copy of this {@link FbcOr} object.
163   */ public
164 FbcOr cloneObject() {
165    long cPtr = libsbmlJNI.FbcOr_cloneObject(swigCPtr, this);
166    return (cPtr == 0) ? null : new FbcOr(cPtr, true);
167  }
168
169  
170/**
171   * Returns the  'ListOfFbcAssociations' in this {@link FbcOr} object.
172   <p>
173   * @return the 'ListOfFbcAssociations' attribute of this {@link FbcOr}.
174   */ public
175 ListOfFbcAssociations getListOfAssociations() {
176    long cPtr = libsbmlJNI.FbcOr_getListOfAssociations__SWIG_0(swigCPtr, this);
177    return (cPtr == 0) ? null : new ListOfFbcAssociations(cPtr, false);
178  }
179
180  
181/**
182   * Get a {@link Association} from the {@link ListOfFbcAssociations}.
183   <p>
184   * @param n the index number of the {@link Association} to get.
185   <p>
186   * @return the nth {@link Association} in the {@link ListOfFbcAssociations} within this {@link FbcOr}.
187   <p>
188   * @see #getNumAssociations()
189   */ public
190 FbcAssociation getAssociation(long n) {
191    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcOr_getAssociation__SWIG_0(swigCPtr, this, n), false);
192}
193
194  
195/**
196   * Get a {@link Association} from the {@link ListOfFbcAssociations}
197   * based on its identifier.
198   <p>
199   * @param sid a string representing the identifier
200   * of the {@link Association} to get.
201   <p>
202   * @return the {@link Association} in the {@link ListOfFbcAssociations}
203   * with the given id or null if no such
204   * {@link Association} exists.
205   <p>
206   * 
207   * @see #getNumAssociations()
208   <p>
209   * @see #getAssociation(long n)
210   */ public
211 FbcAssociation getAssociation(String sid) {
212    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcOr_getAssociation__SWIG_2(swigCPtr, this, sid), false);
213}
214
215  
216/**
217   * Adds a copy the given 'FbcAssociation' to this {@link FbcOr}.
218   <p>
219   * @param fa; the {@link FbcAssociation} object to add
220   <p>
221   * @return integer value indicating success/failure of the
222   * function.   The possible values
223   * returned by this function are:
224   * <ul>
225   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
226   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
227   * </ul>
228   */ public
229 int addAssociation(FbcAssociation fa) {
230    return libsbmlJNI.FbcOr_addAssociation(swigCPtr, this, FbcAssociation.getCPtr(fa), fa);
231  }
232
233  
234/**
235   * Get the number of {@link FbcAssociation} objects in this {@link FbcOr}.
236   <p>
237   * @return the number of {@link FbcAssociation} objects in this {@link FbcOr}
238   */ public
239 long getNumAssociations() {
240    return libsbmlJNI.FbcOr_getNumAssociations(swigCPtr, this);
241  }
242
243  
244/**
245  * Converts this {@link FbcAssociation} object into an infix string representation.
246  <p>
247  * @return the association as infix string.
248  */ public
249 String toInfix() {
250    return libsbmlJNI.FbcOr_toInfix(swigCPtr, this);
251  }
252
253  
254/**
255   * Creates a new {@link FbcAnd} object, adds it to this FbcOrs
256   * {@link ListOfFbcAssociations} and returns the {@link FbcAnd} object created. 
257   <p>
258   * @return a new {@link FbcAnd} object instance
259   <p>
260   * @see #addAssociation(FbcAssociation fa)
261   */ public
262 FbcAnd createAnd() {
263    long cPtr = libsbmlJNI.FbcOr_createAnd(swigCPtr, this);
264    return (cPtr == 0) ? null : new FbcAnd(cPtr, false);
265  }
266
267  
268/**
269   * Creates a new {@link FbcOr} object, adds it to this FbcOrs
270   * {@link ListOfFbcAssociations} and returns the {@link FbcOr} object created. 
271   <p>
272   * @return a new {@link FbcOr} object instance
273   <p>
274   * @see #addAssociation(FbcAssociation fa)
275   */ public
276 FbcOr createOr() {
277    long cPtr = libsbmlJNI.FbcOr_createOr(swigCPtr, this);
278    return (cPtr == 0) ? null : new FbcOr(cPtr, false);
279  }
280
281  
282/**
283   * Creates a new {@link GeneProductRef} object, adds it to this FbcOrs
284   * {@link ListOfFbcAssociations} and returns the {@link GeneProductRef} object created. 
285   <p>
286   * @return a new {@link GeneProductRef} object instance
287   <p>
288   * @see #addAssociation(FbcAssociation fa)
289   */ public
290 GeneProductRef createGeneProductRef() {
291    long cPtr = libsbmlJNI.FbcOr_createGeneProductRef(swigCPtr, this);
292    return (cPtr == 0) ? null : new GeneProductRef(cPtr, false);
293  }
294
295  
296/**
297   * Removes the nth {@link Association} from the {@link ListOfFbcAssociations} within this {@link FbcOr}.
298   * and returns a pointer to it.
299   <p>
300   * The caller owns the returned item and is responsible for deleting it.
301   <p>
302   * @param n the index of the {@link Association} to remove.
303   <p>
304   * @see #getNumAssociations()
305   */ public
306 FbcAssociation removeAssociation(long n) {
307    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcOr_removeAssociation__SWIG_0(swigCPtr, this, n), true);
308}
309
310  
311/**
312   * Removes the {@link Association} with the given identifier from the {@link ListOfFbcAssociations} within this {@link FbcOr}
313   * and returns a pointer to it.
314   <p>
315   * The caller owns the returned item and is responsible for deleting it.
316   * If none of the items in this list have the identifier <code>sid</code>, then
317   * <code>null</code> is returned.
318   <p>
319   * @param sid the identifier of the {@link Association} to remove.
320   <p>
321   * @return the {@link Association} removed. As mentioned above, the caller owns the
322   * returned item.
323   */ public
324 FbcAssociation removeAssociation(String sid) {
325    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcOr_removeAssociation__SWIG_1(swigCPtr, this, sid), true);
326}
327
328  
329/**
330   * Returns the XML element name of this object.
331   <p>
332   * For {@link FbcOr}, the XML element name is always <code>'fbcOr'.</code>
333   <p>
334   * @return the name of this element, i.e. <code>'fbcOr'.</code>
335   */ public
336 String getElementName() {
337    return libsbmlJNI.FbcOr_getElementName(swigCPtr, this);
338  }
339
340  
341/**
342   * Returns the libSBML type code for this SBML object.
343   <p>
344   * <p>
345 * LibSBML attaches an identifying code to every kind of SBML object.  These
346 * are integer constants known as <em>SBML type codes</em>.  The names of all
347 * the codes begin with the characters <code>SBML_</code>.
348 * In the Java language interface for libSBML, the
349 * type codes are defined as static integer constants in the interface class
350 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
351 * package plug-ins may use overlapping type codes; to identify the package
352 * to which a given object belongs, call the <code>getPackageName()</code>
353 * method on the object.
354   <p>
355   * @return the SBML type code for this object:
356   * {@link libsbmlConstants#SBML_FBC_OR SBML_FBC_OR} (default).
357   <p>
358   * <p>
359 * @warning <span class='warning'>The specific integer values of the possible
360 * type codes may be reused by different Level&nbsp;3 package plug-ins.
361 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
362 * both getTypeCode() and getPackageName()</strong>.</span>
363   <p>
364   * @see #getElementName()
365   * @see #getPackageName()
366   */ public
367 int getTypeCode() {
368    return libsbmlJNI.FbcOr_getTypeCode(swigCPtr, this);
369  }
370
371  
372/**
373   * Predicate returning <code>true</code> if all the required attributes
374   * for this {@link FbcOr} object have been set.
375   <p>
376   * @note The required attributes for a {@link FbcOr} object are:
377   <p>
378   * @return a boolean value indicating whether all the required
379   * attributes for this object have been defined.
380   */ public
381 boolean hasRequiredAttributes() {
382    return libsbmlJNI.FbcOr_hasRequiredAttributes(swigCPtr, this);
383  }
384
385  
386/**
387   * Predicate returning <code>true</code> if all the required elements
388   * for this {@link FbcOr} object have been set.
389   <p>
390   * @note The required elements for a {@link FbcOr} object are:
391   <p>
392   * @return a boolean value indicating whether all the required
393   * elements for this object have been defined.
394   */ public
395 boolean hasRequiredElements() {
396    return libsbmlJNI.FbcOr_hasRequiredElements(swigCPtr, this);
397  }
398
399  
400/** * @internal */ public
401 void connectToChild() {
402    libsbmlJNI.FbcOr_connectToChild(swigCPtr, this);
403  }
404
405  
406/** * @internal */ public
407 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
408    libsbmlJNI.FbcOr_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
409  }
410
411}