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 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   <p>
090   * <p>
091 * @note Attempting to add an object to an {@link SBMLDocument} having a different
092 * combination of SBML Level, Version and XML namespaces than the object
093 * itself will result in an error at the time a caller attempts to make the
094 * addition.  A parent object must have compatible Level, Version and XML
095 * namespaces.  (Strictly speaking, a parent may also have more XML
096 * namespaces than a child, but the reverse is not permitted.)  The
097 * restriction is necessary to ensure that an SBML model has a consistent
098 * overall structure.  This requires callers to manage their objects
099 * carefully, but the benefit is increased flexibility in how models can be
100 * created by permitting callers to create objects bottom-up if desired.  In
101 * situations where objects are not yet attached to parents (e.g.,
102 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
103 * libSBML determine such things as whether it is valid to assign a
104 * particular value to an attribute.  For packages, this means that the 
105 * parent object to which this package element is being added must have
106 * been created with the package namespace, or that the package namespace
107 * was added to it, even if that parent is not a package object itself.
108   */ public
109 FbcOr(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
110    this(libsbmlJNI.new_FbcOr__SWIG_0(level, version, pkgVersion), true);
111  }
112
113  
114/**
115   * Creates a new {@link FbcOr} with the given SBML Level, Version, and
116   * &ldquo;fbc&rdquo;package version.
117   <p>
118   * @param level a long integer, the SBML Level to assign to this {@link FbcOr}.
119   <p>
120   * @param version a long integer, the SBML Version to assign to this {@link FbcOr}.
121   <p>
122   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
123   * this {@link FbcOr}.
124   <p>
125   * <p>
126 * @note Attempting to add an object to an {@link SBMLDocument} having a different
127 * combination of SBML Level, Version and XML namespaces than the object
128 * itself will result in an error at the time a caller attempts to make the
129 * addition.  A parent object must have compatible Level, Version and XML
130 * namespaces.  (Strictly speaking, a parent may also have more XML
131 * namespaces than a child, but the reverse is not permitted.)  The
132 * restriction is necessary to ensure that an SBML model has a consistent
133 * overall structure.  This requires callers to manage their objects
134 * carefully, but the benefit is increased flexibility in how models can be
135 * created by permitting callers to create objects bottom-up if desired.  In
136 * situations where objects are not yet attached to parents (e.g.,
137 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
138 * libSBML determine such things as whether it is valid to assign a
139 * particular value to an attribute.  For packages, this means that the 
140 * parent object to which this package element is being added must have
141 * been created with the package namespace, or that the package namespace
142 * was added to it, even if that parent is not a package object itself.
143   */ public
144 FbcOr(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
145    this(libsbmlJNI.new_FbcOr__SWIG_1(level, version), true);
146  }
147
148  
149/**
150   * Creates a new {@link FbcOr} with the given SBML Level, Version, and
151   * &ldquo;fbc&rdquo;package version.
152   <p>
153   * @param level a long integer, the SBML Level to assign to this {@link FbcOr}.
154   <p>
155   * @param version a long integer, the SBML Version to assign to this {@link FbcOr}.
156   <p>
157   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
158   * this {@link FbcOr}.
159   <p>
160   * <p>
161 * @note Attempting to add an object to an {@link SBMLDocument} having a different
162 * combination of SBML Level, Version and XML namespaces than the object
163 * itself will result in an error at the time a caller attempts to make the
164 * addition.  A parent object must have compatible Level, Version and XML
165 * namespaces.  (Strictly speaking, a parent may also have more XML
166 * namespaces than a child, but the reverse is not permitted.)  The
167 * restriction is necessary to ensure that an SBML model has a consistent
168 * overall structure.  This requires callers to manage their objects
169 * carefully, but the benefit is increased flexibility in how models can be
170 * created by permitting callers to create objects bottom-up if desired.  In
171 * situations where objects are not yet attached to parents (e.g.,
172 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
173 * libSBML determine such things as whether it is valid to assign a
174 * particular value to an attribute.  For packages, this means that the 
175 * parent object to which this package element is being added must have
176 * been created with the package namespace, or that the package namespace
177 * was added to it, even if that parent is not a package object itself.
178   */ public
179 FbcOr(long level) throws org.sbml.libsbml.SBMLConstructorException {
180    this(libsbmlJNI.new_FbcOr__SWIG_2(level), true);
181  }
182
183  
184/**
185   * Creates a new {@link FbcOr} with the given SBML Level, Version, and
186   * &ldquo;fbc&rdquo;package version.
187   <p>
188   * @param level a long integer, the SBML Level to assign to this {@link FbcOr}.
189   <p>
190   * @param version a long integer, the SBML Version to assign to this {@link FbcOr}.
191   <p>
192   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
193   * this {@link FbcOr}.
194   <p>
195   * <p>
196 * @note Attempting to add an object to an {@link SBMLDocument} having a different
197 * combination of SBML Level, Version and XML namespaces than the object
198 * itself will result in an error at the time a caller attempts to make the
199 * addition.  A parent object must have compatible Level, Version and XML
200 * namespaces.  (Strictly speaking, a parent may also have more XML
201 * namespaces than a child, but the reverse is not permitted.)  The
202 * restriction is necessary to ensure that an SBML model has a consistent
203 * overall structure.  This requires callers to manage their objects
204 * carefully, but the benefit is increased flexibility in how models can be
205 * created by permitting callers to create objects bottom-up if desired.  In
206 * situations where objects are not yet attached to parents (e.g.,
207 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
208 * libSBML determine such things as whether it is valid to assign a
209 * particular value to an attribute.  For packages, this means that the 
210 * parent object to which this package element is being added must have
211 * been created with the package namespace, or that the package namespace
212 * was added to it, even if that parent is not a package object itself.
213   */ public
214 FbcOr() throws org.sbml.libsbml.SBMLConstructorException {
215    this(libsbmlJNI.new_FbcOr__SWIG_3(), true);
216  }
217
218  
219/**
220   * Creates a new {@link FbcOr} with the given {@link FbcPkgNamespaces} object.
221   <p>
222   * <p>
223 * The package namespaces object used in this constructor is derived from a
224 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
225 * information.  It is used to communicate the SBML Level, Version, and 
226 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
227 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
228 * package namespace object somewhere in a program once, then hand that object
229 * as needed to object constructors of that package that accept it as and
230 * argument, such as this one.
231   <p>
232   * @param fbcns the {@link FbcPkgNamespaces} object.
233   <p>
234   * <p>
235 * @note Attempting to add an object to an {@link SBMLDocument} having a different
236 * combination of SBML Level, Version and XML namespaces than the object
237 * itself will result in an error at the time a caller attempts to make the
238 * addition.  A parent object must have compatible Level, Version and XML
239 * namespaces.  (Strictly speaking, a parent may also have more XML
240 * namespaces than a child, but the reverse is not permitted.)  The
241 * restriction is necessary to ensure that an SBML model has a consistent
242 * overall structure.  This requires callers to manage their objects
243 * carefully, but the benefit is increased flexibility in how models can be
244 * created by permitting callers to create objects bottom-up if desired.  In
245 * situations where objects are not yet attached to parents (e.g.,
246 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
247 * libSBML determine such things as whether it is valid to assign a
248 * particular value to an attribute.  For packages, this means that the 
249 * parent object to which this package element is being added must have
250 * been created with the package namespace, or that the package namespace
251 * was added to it, even if that parent is not a package object itself.
252   */ public
253 FbcOr(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
254    this(libsbmlJNI.new_FbcOr__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
255  }
256
257  
258/**
259   * Copy constructor for {@link FbcOr}.
260   <p>
261   * @param orig the {@link FbcOr} instance to copy.
262   */ public
263 FbcOr(FbcOr orig) throws org.sbml.libsbml.SBMLConstructorException {
264    this(libsbmlJNI.new_FbcOr__SWIG_5(FbcOr.getCPtr(orig), orig), true);
265  }
266
267  
268/**
269   * Creates and returns a deep copy of this {@link FbcOr} object.
270   <p>
271   * @return a (deep) copy of this {@link FbcOr} object.
272   */ public
273 FbcOr cloneObject() {
274    long cPtr = libsbmlJNI.FbcOr_cloneObject(swigCPtr, this);
275    return (cPtr == 0) ? null : new FbcOr(cPtr, true);
276  }
277
278  
279/**
280   * Returns the {@link ListOfFbcAssociations} in this {@link FbcOr} object.
281   <p>
282   * @return the {@link ListOfFbcAssociations} child of this {@link FbcOr}.
283   */ public
284 ListOfFbcAssociations getListOfAssociations() {
285    long cPtr = libsbmlJNI.FbcOr_getListOfAssociations__SWIG_0(swigCPtr, this);
286    return (cPtr == 0) ? null : new ListOfFbcAssociations(cPtr, false);
287  }
288
289  
290/**
291   * Get a {@link Association} from the {@link ListOfFbcAssociations}.
292   <p>
293   * @param n the index number of the {@link Association} to get.
294   <p>
295   * @return the nth {@link Association} in the {@link ListOfFbcAssociations} within this {@link FbcOr}.
296   <p>
297   * @see #getNumAssociations()
298   */ public
299 FbcAssociation getAssociation(long n) {
300    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcOr_getAssociation__SWIG_0(swigCPtr, this, n), false);
301}
302
303  
304/**
305   * Get a {@link Association} from the {@link ListOfFbcAssociations}
306   * based on its identifier.
307   <p>
308   * @param sid a string representing the identifier
309   * of the {@link Association} to get.
310   <p>
311   * @return the {@link Association} in the {@link ListOfFbcAssociations}
312   * with the given id or <code>null</code> if no such
313   * {@link Association} exists.
314   <p>
315   * 
316   * @see #getNumAssociations()
317   <p>
318   * @see #getAssociation(long n)
319   */ public
320 FbcAssociation getAssociation(String sid) {
321    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcOr_getAssociation__SWIG_2(swigCPtr, this, sid), false);
322}
323
324  
325/**
326   * Adds a copy the given {@link FbcAssociation} to this {@link FbcOr}.
327   <p>
328   * @param fa the {@link FbcAssociation} object to add.
329   <p>
330   * <p>
331 * @return integer value indicating success/failure of the
332 * function.   The possible values
333 * returned by this function are:
334   * <ul>
335   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
336   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
337   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
338   * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH}
339   * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH}
340   * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH}
341   * <li> {@link libsbmlConstants#LIBSBML_NAMESPACES_MISMATCH LIBSBML_NAMESPACES_MISMATCH}
342   * </ul>
343   */ public
344 int addAssociation(FbcAssociation fa) {
345    return libsbmlJNI.FbcOr_addAssociation(swigCPtr, this, FbcAssociation.getCPtr(fa), fa);
346  }
347
348  
349/**
350   * Get the number of {@link FbcAssociation} objects in this {@link FbcOr}.
351   <p>
352   * @return the number of {@link FbcAssociation} objects in this {@link FbcOr}.
353   */ public
354 long getNumAssociations() {
355    return libsbmlJNI.FbcOr_getNumAssociations(swigCPtr, this);
356  }
357
358  
359/**
360  * Converts this {@link FbcAssociation} object into an infix string representation.
361  <p>
362  * @return the association as infix string.
363  */ public
364 String toInfix(boolean usingId) {
365    return libsbmlJNI.FbcOr_toInfix__SWIG_0(swigCPtr, this, usingId);
366  }
367
368  
369/**
370  * Converts this {@link FbcAssociation} object into an infix string representation.
371  <p>
372  * @return the association as infix string.
373  */ public
374 String toInfix() {
375    return libsbmlJNI.FbcOr_toInfix__SWIG_1(swigCPtr, this);
376  }
377
378  
379/**
380   * Creates a new {@link FbcAnd} object, adds it to this {@link FbcOr}'s
381   * {@link ListOfFbcAssociations} and returns the {@link FbcAnd} object created. 
382   <p>
383   * @return a new {@link FbcAnd} object instance.
384   <p>
385   * @see #addAssociation(FbcAssociation fa)
386   */ public
387 FbcAnd createAnd() {
388    long cPtr = libsbmlJNI.FbcOr_createAnd(swigCPtr, this);
389    return (cPtr == 0) ? null : new FbcAnd(cPtr, false);
390  }
391
392  
393/**
394   * Creates a new {@link FbcOr} object, adds it to this {@link FbcOr}'s
395   * {@link ListOfFbcAssociations} and returns the {@link FbcOr} object created. 
396   <p>
397   * @return a new {@link FbcOr} object instance.
398   <p>
399   * @see #addAssociation(FbcAssociation fa)
400   */ public
401 FbcOr createOr() {
402    long cPtr = libsbmlJNI.FbcOr_createOr(swigCPtr, this);
403    return (cPtr == 0) ? null : new FbcOr(cPtr, false);
404  }
405
406  
407/**
408   * Creates a new {@link GeneProductRef} object, adds it to this {@link FbcOr}'s
409   * {@link ListOfFbcAssociations} and returns the {@link GeneProductRef} object created. 
410   <p>
411   * @return a new {@link GeneProductRef} object instance.
412   <p>
413   * @see #addAssociation(FbcAssociation fa)
414   */ public
415 GeneProductRef createGeneProductRef() {
416    long cPtr = libsbmlJNI.FbcOr_createGeneProductRef(swigCPtr, this);
417    return (cPtr == 0) ? null : new GeneProductRef(cPtr, false);
418  }
419
420  
421/**
422   * Removes the nth {@link Association} from the {@link ListOfFbcAssociations} within this {@link FbcOr}
423   * and returns a pointer to it.
424   <p>
425   * The caller owns the returned item and is responsible for deleting it.
426   <p>
427   * @param n the index of the {@link Association} to remove.
428   <p>
429   * @see #getNumAssociations()
430   */ public
431 FbcAssociation removeAssociation(long n) {
432    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcOr_removeAssociation__SWIG_0(swigCPtr, this, n), true);
433}
434
435  
436/**
437   * Removes the {@link Association} with the given identifier from the {@link ListOfFbcAssociations} within this {@link FbcOr}
438   * and returns a pointer to it.
439   <p>
440   * The caller owns the returned item and is responsible for deleting it.
441   * If none of the items in this list have the identifier <code>sid</code>, then
442   * <code>null</code> is returned.
443   <p>
444   * @param sid the identifier of the {@link Association} to remove.
445   <p>
446   * @return the {@link Association} removed. As mentioned above, the caller owns the
447   * returned item.
448   */ public
449 FbcAssociation removeAssociation(String sid) {
450    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcOr_removeAssociation__SWIG_1(swigCPtr, this, sid), true);
451}
452
453  
454/**
455   * Returns the XML element name of this object.
456   <p>
457   * For {@link FbcOr}, the XML element name is always <code>'fbcOr'.</code>
458   <p>
459   * @return the name of this element, i.e. <code>'fbcOr'.</code>
460   */ public
461 String getElementName() {
462    return libsbmlJNI.FbcOr_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_FBC_OR SBML_FBC_OR} (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.FbcOr_getTypeCode(swigCPtr, this);
496  }
497
498  
499/**
500   * Predicate returning <code>true</code> if all the required attributes
501   * for this {@link FbcOr} object have been set.  Will always return
502   * <code>true</code>, since {@link FbcOr} has no required attributes.
503   <p>
504   * @return a boolean value indicating whether all the required
505   * attributes for this object have been defined.
506   */ public
507 boolean hasRequiredAttributes() {
508    return libsbmlJNI.FbcOr_hasRequiredAttributes(swigCPtr, this);
509  }
510
511  
512/**
513   * Predicate returning <code>true</code> if all the required elements
514   * for this {@link FbcOr} object have been set.
515   <p>
516   * @note An {@link FbcOr} object must have at least two {@link FbcAssociation}
517   * children.
518   <p>
519   * @return a boolean value indicating whether all the required
520   * elements for this object have been defined.
521   */ public
522 boolean hasRequiredElements() {
523    return libsbmlJNI.FbcOr_hasRequiredElements(swigCPtr, this);
524  }
525
526  
527/** * @internal */ public
528 void connectToChild() {
529    libsbmlJNI.FbcOr_connectToChild(swigCPtr, this);
530  }
531
532  
533/** * @internal */ public
534 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
535    libsbmlJNI.FbcOr_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
536  }
537
538}