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