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;and&rdquo; relationship for gene products
014 <p>
015 * {@link FbcAnd} 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 'and' relationship between two
017 * or more child {@link FbcAssociation} objects.  In other words, it indicates that
018 * all of the child objects are included.  Note that since the {@link FbcAssociation}
019 * class is the parent class of {@link GeneProductRef}, {@link FbcAnd} and {@link FbcOr}, a given
020 * {@link FbcAnd} can potentially include nested 'and'/'or' combinations of gene
021 * 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 FbcOr
033 * @see GeneProductRef
034 */
035
036public class FbcAnd extends FbcAssociation {
037   private long swigCPtr;
038
039   protected FbcAnd(long cPtr, boolean cMemoryOwn)
040   {
041     super(libsbmlJNI.FbcAnd_SWIGUpcast(cPtr), cMemoryOwn);
042     swigCPtr = cPtr;
043   }
044
045   protected static long getCPtr(FbcAnd obj)
046   {
047     return (obj == null) ? 0 : obj.swigCPtr;
048   }
049
050   protected static long getCPtrAndDisown (FbcAnd 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_FbcAnd(swigCPtr);
072      }
073      swigCPtr = 0;
074    }
075    super.delete();
076  }
077
078  
079/**
080   * Creates a new {@link FbcAnd} 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 FbcAnd}.
084   <p>
085   * @param version a long integer, the SBML Version to assign to this
086   * {@link FbcAnd}.
087   <p>
088   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
089   * this {@link FbcAnd}.
090   <p>
091   * <p>
092 * @note Attempting to add an object to an {@link SBMLDocument} having a different
093 * combination of SBML Level, Version and XML namespaces than the object
094 * itself will result in an error at the time a caller attempts to make the
095 * addition.  A parent object must have compatible Level, Version and XML
096 * namespaces.  (Strictly speaking, a parent may also have more XML
097 * namespaces than a child, but the reverse is not permitted.)  The
098 * restriction is necessary to ensure that an SBML model has a consistent
099 * overall structure.  This requires callers to manage their objects
100 * carefully, but the benefit is increased flexibility in how models can be
101 * created by permitting callers to create objects bottom-up if desired.  In
102 * situations where objects are not yet attached to parents (e.g.,
103 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
104 * libSBML determine such things as whether it is valid to assign a
105 * particular value to an attribute.  For packages, this means that the 
106 * parent object to which this package element is being added must have
107 * been created with the package namespace, or that the package namespace
108 * was added to it, even if that parent is not a package object itself.
109   */ public
110 FbcAnd(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
111    this(libsbmlJNI.new_FbcAnd__SWIG_0(level, version, pkgVersion), true);
112  }
113
114  
115/**
116   * Creates a new {@link FbcAnd} with the given SBML Level, Version, and
117   * &ldquo;fbc&rdquo;package version.
118   <p>
119   * @param level a long integer, the SBML Level to assign to this {@link FbcAnd}.
120   <p>
121   * @param version a long integer, the SBML Version to assign to this
122   * {@link FbcAnd}.
123   <p>
124   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
125   * this {@link FbcAnd}.
126   <p>
127   * <p>
128 * @note Attempting to add an object to an {@link SBMLDocument} having a different
129 * combination of SBML Level, Version and XML namespaces than the object
130 * itself will result in an error at the time a caller attempts to make the
131 * addition.  A parent object must have compatible Level, Version and XML
132 * namespaces.  (Strictly speaking, a parent may also have more XML
133 * namespaces than a child, but the reverse is not permitted.)  The
134 * restriction is necessary to ensure that an SBML model has a consistent
135 * overall structure.  This requires callers to manage their objects
136 * carefully, but the benefit is increased flexibility in how models can be
137 * created by permitting callers to create objects bottom-up if desired.  In
138 * situations where objects are not yet attached to parents (e.g.,
139 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
140 * libSBML determine such things as whether it is valid to assign a
141 * particular value to an attribute.  For packages, this means that the 
142 * parent object to which this package element is being added must have
143 * been created with the package namespace, or that the package namespace
144 * was added to it, even if that parent is not a package object itself.
145   */ public
146 FbcAnd(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
147    this(libsbmlJNI.new_FbcAnd__SWIG_1(level, version), true);
148  }
149
150  
151/**
152   * Creates a new {@link FbcAnd} with the given SBML Level, Version, and
153   * &ldquo;fbc&rdquo;package version.
154   <p>
155   * @param level a long integer, the SBML Level to assign to this {@link FbcAnd}.
156   <p>
157   * @param version a long integer, the SBML Version to assign to this
158   * {@link FbcAnd}.
159   <p>
160   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
161   * this {@link FbcAnd}.
162   <p>
163   * <p>
164 * @note Attempting to add an object to an {@link SBMLDocument} having a different
165 * combination of SBML Level, Version and XML namespaces than the object
166 * itself will result in an error at the time a caller attempts to make the
167 * addition.  A parent object must have compatible Level, Version and XML
168 * namespaces.  (Strictly speaking, a parent may also have more XML
169 * namespaces than a child, but the reverse is not permitted.)  The
170 * restriction is necessary to ensure that an SBML model has a consistent
171 * overall structure.  This requires callers to manage their objects
172 * carefully, but the benefit is increased flexibility in how models can be
173 * created by permitting callers to create objects bottom-up if desired.  In
174 * situations where objects are not yet attached to parents (e.g.,
175 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
176 * libSBML determine such things as whether it is valid to assign a
177 * particular value to an attribute.  For packages, this means that the 
178 * parent object to which this package element is being added must have
179 * been created with the package namespace, or that the package namespace
180 * was added to it, even if that parent is not a package object itself.
181   */ public
182 FbcAnd(long level) throws org.sbml.libsbml.SBMLConstructorException {
183    this(libsbmlJNI.new_FbcAnd__SWIG_2(level), true);
184  }
185
186  
187/**
188   * Creates a new {@link FbcAnd} with the given SBML Level, Version, and
189   * &ldquo;fbc&rdquo;package version.
190   <p>
191   * @param level a long integer, the SBML Level to assign to this {@link FbcAnd}.
192   <p>
193   * @param version a long integer, the SBML Version to assign to this
194   * {@link FbcAnd}.
195   <p>
196   * @param pkgVersion a long integer, the SBML Fbc Version to assign to
197   * this {@link FbcAnd}.
198   <p>
199   * <p>
200 * @note Attempting to add an object to an {@link SBMLDocument} having a different
201 * combination of SBML Level, Version and XML namespaces than the object
202 * itself will result in an error at the time a caller attempts to make the
203 * addition.  A parent object must have compatible Level, Version and XML
204 * namespaces.  (Strictly speaking, a parent may also have more XML
205 * namespaces than a child, but the reverse is not permitted.)  The
206 * restriction is necessary to ensure that an SBML model has a consistent
207 * overall structure.  This requires callers to manage their objects
208 * carefully, but the benefit is increased flexibility in how models can be
209 * created by permitting callers to create objects bottom-up if desired.  In
210 * situations where objects are not yet attached to parents (e.g.,
211 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
212 * libSBML determine such things as whether it is valid to assign a
213 * particular value to an attribute.  For packages, this means that the 
214 * parent object to which this package element is being added must have
215 * been created with the package namespace, or that the package namespace
216 * was added to it, even if that parent is not a package object itself.
217   */ public
218 FbcAnd() throws org.sbml.libsbml.SBMLConstructorException {
219    this(libsbmlJNI.new_FbcAnd__SWIG_3(), true);
220  }
221
222  
223/**
224   * Creates a new {@link FbcAnd} with the given {@link FbcPkgNamespaces} object.
225   <p>
226   * <p>
227 * The package namespaces object used in this constructor is derived from a
228 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
229 * information.  It is used to communicate the SBML Level, Version, and 
230 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
231 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
232 * package namespace object somewhere in a program once, then hand that object
233 * as needed to object constructors of that package that accept it as and
234 * argument, such as this one.
235   <p>
236   * @param fbcns the {@link FbcPkgNamespaces} object.
237   <p>
238   * <p>
239 * @note Attempting to add an object to an {@link SBMLDocument} having a different
240 * combination of SBML Level, Version and XML namespaces than the object
241 * itself will result in an error at the time a caller attempts to make the
242 * addition.  A parent object must have compatible Level, Version and XML
243 * namespaces.  (Strictly speaking, a parent may also have more XML
244 * namespaces than a child, but the reverse is not permitted.)  The
245 * restriction is necessary to ensure that an SBML model has a consistent
246 * overall structure.  This requires callers to manage their objects
247 * carefully, but the benefit is increased flexibility in how models can be
248 * created by permitting callers to create objects bottom-up if desired.  In
249 * situations where objects are not yet attached to parents (e.g.,
250 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
251 * libSBML determine such things as whether it is valid to assign a
252 * particular value to an attribute.  For packages, this means that the 
253 * parent object to which this package element is being added must have
254 * been created with the package namespace, or that the package namespace
255 * was added to it, even if that parent is not a package object itself.
256   */ public
257 FbcAnd(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
258    this(libsbmlJNI.new_FbcAnd__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
259  }
260
261  
262/**
263   * Copy constructor for {@link FbcAnd}.
264   <p>
265   * @param orig the {@link FbcAnd} instance to copy.
266   */ public
267 FbcAnd(FbcAnd orig) throws org.sbml.libsbml.SBMLConstructorException {
268    this(libsbmlJNI.new_FbcAnd__SWIG_5(FbcAnd.getCPtr(orig), orig), true);
269  }
270
271  
272/**
273   * Creates and returns a deep copy of this {@link FbcAnd} object.
274   <p>
275   * @return a (deep) copy of this {@link FbcAnd} object.
276   */ public
277 FbcAnd cloneObject() {
278    long cPtr = libsbmlJNI.FbcAnd_cloneObject(swigCPtr, this);
279    return (cPtr == 0) ? null : new FbcAnd(cPtr, true);
280  }
281
282  
283/**
284   * Returns the  'ListOfFbcAssociations' in this {@link FbcAnd} object.
285   <p>
286   * @return the 'ListOfFbcAssociations' attribute of this {@link FbcAnd}.
287   */ public
288 ListOfFbcAssociations getListOfAssociations() {
289    long cPtr = libsbmlJNI.FbcAnd_getListOfAssociations__SWIG_0(swigCPtr, this);
290    return (cPtr == 0) ? null : new ListOfFbcAssociations(cPtr, false);
291  }
292
293  
294/**
295   * Get the nth object from the {@link ListOfFbcAssociations}.
296   <p>
297   * @param n the index number of the {@link FbcAssociation} to get.
298   <p>
299   * @return the nth {@link FbcAssociation} in the {@link ListOfFbcAssociations} within this
300   * {@link FbcAnd}.
301   <p>
302   * @see #getNumAssociations()
303   */ public
304 FbcAssociation getAssociation(long n) {
305    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAnd_getAssociation__SWIG_0(swigCPtr, this, n), false);
306}
307
308  
309/**
310   * Get an {@link FbcAssociation} from the {@link ListOfFbcAssociations}
311   * based on its identifier.
312   <p>
313   * @param sid a string representing the identifier
314   * of the {@link FbcAssociation} to get.
315   <p>
316   * @return the {@link FbcAssociation} in the {@link ListOfFbcAssociations}
317   * with the given id or null if no such
318   * {@link FbcAssociation} exists.
319   <p>
320   * 
321   * @see #getNumAssociations()
322   <p>
323   * @see #getAssociation(long n)
324   */ public
325 FbcAssociation getAssociation(String sid) {
326    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAnd_getAssociation__SWIG_2(swigCPtr, this, sid), false);
327}
328
329  
330/**
331   * Adds a copy the given {@link FbcAssociation} to this {@link FbcAnd}.
332   <p>
333   * @param fa the {@link FbcAssociation} object to add.
334   <p>
335   * <p>
336 * @return integer value indicating success/failure of the
337 * function.   The possible values
338 * returned by this function are:
339   * <ul>
340   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
341   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
342   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
343   * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH}
344   * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH}
345   * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH}
346   * <li> {@link libsbmlConstants#LIBSBML_NAMESPACES_MISMATCH LIBSBML_NAMESPACES_MISMATCH}
347   * </ul>
348   */ public
349 int addAssociation(FbcAssociation fa) {
350    return libsbmlJNI.FbcAnd_addAssociation(swigCPtr, this, FbcAssociation.getCPtr(fa), fa);
351  }
352
353  
354/**
355   * Get the number of {@link FbcAssociation} objects in this {@link FbcAnd}.
356   <p>
357   * @return the number of {@link FbcAssociation} objects in this {@link FbcAnd}.
358   */ public
359 long getNumAssociations() {
360    return libsbmlJNI.FbcAnd_getNumAssociations(swigCPtr, this);
361  }
362
363  
364/**
365  * Converts this {@link FbcAssociation} object into an infix string representation.
366  <p>
367  * @return the association as infix string.
368  */ public
369 String toInfix(boolean usingId) {
370    return libsbmlJNI.FbcAnd_toInfix__SWIG_0(swigCPtr, this, usingId);
371  }
372
373  
374/**
375  * Converts this {@link FbcAssociation} object into an infix string representation.
376  <p>
377  * @return the association as infix string.
378  */ public
379 String toInfix() {
380    return libsbmlJNI.FbcAnd_toInfix__SWIG_1(swigCPtr, this);
381  }
382
383  
384/**
385   * Creates a new {@link FbcAnd} object, adds it to this {@link FbcAnd}'s
386   * {@link ListOfFbcAssociations} and returns the {@link FbcAnd} object created. 
387   <p>
388   * @return a new {@link FbcAnd} object instance.
389   <p>
390   * @see #addAssociation(FbcAssociation fa)
391   */ public
392 FbcAnd createAnd() {
393    long cPtr = libsbmlJNI.FbcAnd_createAnd(swigCPtr, this);
394    return (cPtr == 0) ? null : new FbcAnd(cPtr, false);
395  }
396
397  
398/**
399   * Creates a new {@link FbcOr} object, adds it to this {@link FbcAnd}'s
400   * {@link ListOfFbcAssociations} and returns the {@link FbcOr} object created. 
401   <p>
402   * @return a new {@link FbcOr} object instance.
403   <p>
404   * @see #addAssociation(FbcAssociation fa)
405   */ public
406 FbcOr createOr() {
407    long cPtr = libsbmlJNI.FbcAnd_createOr(swigCPtr, this);
408    return (cPtr == 0) ? null : new FbcOr(cPtr, false);
409  }
410
411  
412/**
413   * Creates a new {@link GeneProductRef} object, adds it to this {@link FbcAnd}'s
414   * {@link ListOfFbcAssociations} and returns the {@link GeneProductRef} object created. 
415   <p>
416   * @return a new {@link GeneProductRef} object instance.
417   <p>
418   * @see #addAssociation(FbcAssociation fa)
419   */ public
420 GeneProductRef createGeneProductRef() {
421    long cPtr = libsbmlJNI.FbcAnd_createGeneProductRef(swigCPtr, this);
422    return (cPtr == 0) ? null : new GeneProductRef(cPtr, false);
423  }
424
425  
426/**
427   * Removes the nth {@link FbcAssociation} from the {@link ListOfFbcAssociations} within this 
428   * {@link FbcAnd} and returns a pointer to it.
429   <p>
430   * The caller owns the returned item and is responsible for deleting it.
431   <p>
432   * @param n the index of the {@link FbcAssociation} to remove.
433   <p>
434   * @see #getNumAssociations()
435   */ public
436 FbcAssociation removeAssociation(long n) {
437    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAnd_removeAssociation__SWIG_0(swigCPtr, this, n), true);
438}
439
440  
441/**
442   * Removes the {@link FbcAssociation} with the given identifier from the 
443   * {@link ListOfFbcAssociations} within this {@link FbcAnd} and returns a pointer to it.
444   <p>
445   * The caller owns the returned item and is responsible for deleting it.
446   * If none of the items in this list have the identifier <code>sid</code>, then
447   * <code>null</code> is returned.
448   <p>
449   * @param sid the identifier of the {@link FbcAssociation} to remove.
450   <p>
451   * @return the {@link FbcAssociation} removed. As mentioned above, the caller owns the
452   * returned item.
453   */ public
454 FbcAssociation removeAssociation(String sid) {
455    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAnd_removeAssociation__SWIG_1(swigCPtr, this, sid), true);
456}
457
458  
459/**
460   * Returns the XML element name of this object.
461   <p>
462   * For {@link FbcAnd}, the XML element name is always <code>'fbcAnd'.</code>
463   <p>
464   * @return the name of this element, i.e. <code>'fbcAnd'.</code>
465   */ public
466 String getElementName() {
467    return libsbmlJNI.FbcAnd_getElementName(swigCPtr, this);
468  }
469
470  
471/**
472   * Returns the libSBML type code for this SBML object.
473   <p>
474   * <p>
475 * LibSBML attaches an identifying code to every kind of SBML object.  These
476 * are integer constants known as <em>SBML type codes</em>.  The names of all
477 * the codes begin with the characters <code>SBML_</code>.
478 * In the Java language interface for libSBML, the
479 * type codes are defined as static integer constants in the interface class
480 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
481 * package plug-ins may use overlapping type codes; to identify the package
482 * to which a given object belongs, call the <code>getPackageName()</code>
483 * method on the object.
484   <p>
485   * @return the SBML type code for this object:
486   * {@link libsbmlConstants#SBML_FBC_AND SBML_FBC_AND} (default).
487   <p>
488   * <p>
489 * @warning <span class='warning'>The specific integer values of the possible
490 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
491 * packages,  To fully identify the correct code, <strong>it is necessary to
492 * invoke both getTypeCode() and getPackageName()</strong>.</span>
493   <p>
494   * @see #getElementName()
495   * @see #getPackageName()
496   */ public
497 int getTypeCode() {
498    return libsbmlJNI.FbcAnd_getTypeCode(swigCPtr, this);
499  }
500
501  
502/**
503   * Predicate returning <code>true</code> if all the required attributes
504   * for this {@link FbcAnd} object have been set.  Will always return
505   * <code>true</code>, since {@link FbcOr} has no required attributes.
506   <p>
507   * @return a boolean value indicating whether all the required
508   * attributes for this object have been defined.
509   */ public
510 boolean hasRequiredAttributes() {
511    return libsbmlJNI.FbcAnd_hasRequiredAttributes(swigCPtr, this);
512  }
513
514  
515/**
516   * Predicate returning <code>true</code> if all the required elements
517   * for this {@link FbcAnd} object have been set.
518   <p>
519   * @note An {@link FbcAnd} object must have at least two {@link FbcAssociation}
520   * children.
521   <p>
522   * @return a boolean value indicating whether all the required
523   * elements for this object have been defined.
524   */ public
525 boolean hasRequiredElements() {
526    return libsbmlJNI.FbcAnd_hasRequiredElements(swigCPtr, this);
527  }
528
529  
530/** * @internal */ public
531 void connectToChild() {
532    libsbmlJNI.FbcAnd_connectToChild(swigCPtr, this);
533  }
534
535  
536/** * @internal */ public
537 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
538    libsbmlJNI.FbcAnd_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
539  }
540
541}