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 Base class for {@link FbcAnd}, {@link FbcOr}, and {@link GeneProductRef}
014 <p>
015 * The {@link FbcAssociation} class is the abstract base class for the classes that
016 * can be used as children of the {@link GeneProductAssociation} child of a {@link Reaction}.
017 * The {@link FbcAnd} class is used when all of its children are definitely associated
018 * with the {@link Reaction}; the {@link FbcOr} class is used when at least one of its children
019 * are associated with the {@link Reaction}; and the {@link GeneProductRef} class is used to
020 * denote a particular {@link GeneProduct}.
021 <p>
022 * <p>
023 * @note This class of objects was introduced in Version&nbsp;2 of the
024 * SBML Level&nbsp;3 Flux Balance Constraints (&ldquo;fbc&rdquo;)
025 * specification.  In Version&nbsp;1 of &ldquo;fbc&rdquo;, the information
026 * encoded by this class can be stored instead using the {@link Association} and
027 * {@link GeneAssociation} annotation classes.  Please see the Version&nbsp;1 and
028 * Version&nbsp;2 &ldquo;fbc&rdquo; specifications for more details.
029 <p>
030 * @see ListOfFbcAssociations
031 * @see FbcAnd
032 * @see FbcOr
033 * @see GeneProductRef
034 */
035
036public class FbcAssociation extends SBase {
037   private long swigCPtr;
038
039   protected FbcAssociation(long cPtr, boolean cMemoryOwn)
040   {
041     super(libsbmlJNI.FbcAssociation_SWIGUpcast(cPtr), cMemoryOwn);
042     swigCPtr = cPtr;
043   }
044
045   protected static long getCPtr(FbcAssociation obj)
046   {
047     return (obj == null) ? 0 : obj.swigCPtr;
048   }
049
050   protected static long getCPtrAndDisown (FbcAssociation 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_FbcAssociation(swigCPtr);
072      }
073      swigCPtr = 0;
074    }
075    super.delete();
076  }
077
078  
079/**
080   * Creates a new {@link FbcAssociation} 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
084   * {@link FbcAssociation}.
085   <p>
086   * @param version a long integer, the SBML Version to assign to this
087   * {@link FbcAssociation}.
088   <p>
089   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
090   * Version to assign to this {@link FbcAssociation}.
091   <p>
092   * <p>
093 * @note Attempting to add an object to an {@link SBMLDocument} having a different
094 * combination of SBML Level, Version and XML namespaces than the object
095 * itself will result in an error at the time a caller attempts to make the
096 * addition.  A parent object must have compatible Level, Version and XML
097 * namespaces.  (Strictly speaking, a parent may also have more XML
098 * namespaces than a child, but the reverse is not permitted.)  The
099 * restriction is necessary to ensure that an SBML model has a consistent
100 * overall structure.  This requires callers to manage their objects
101 * carefully, but the benefit is increased flexibility in how models can be
102 * created by permitting callers to create objects bottom-up if desired.  In
103 * situations where objects are not yet attached to parents (e.g.,
104 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
105 * libSBML determine such things as whether it is valid to assign a
106 * particular value to an attribute.  For packages, this means that the 
107 * parent object to which this package element is being added must have
108 * been created with the package namespace, or that the package namespace
109 * was added to it, even if that parent is not a package object itself.
110   */ public
111 FbcAssociation(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
112    this(libsbmlJNI.new_FbcAssociation__SWIG_0(level, version, pkgVersion), true);
113  }
114
115  
116/**
117   * Creates a new {@link FbcAssociation} with the given SBML Level, Version, and
118   * &ldquo;fbc&rdquo;package version.
119   <p>
120   * @param level a long integer, the SBML Level to assign to this
121   * {@link FbcAssociation}.
122   <p>
123   * @param version a long integer, the SBML Version to assign to this
124   * {@link FbcAssociation}.
125   <p>
126   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
127   * Version to assign to this {@link FbcAssociation}.
128   <p>
129   * <p>
130 * @note Attempting to add an object to an {@link SBMLDocument} having a different
131 * combination of SBML Level, Version and XML namespaces than the object
132 * itself will result in an error at the time a caller attempts to make the
133 * addition.  A parent object must have compatible Level, Version and XML
134 * namespaces.  (Strictly speaking, a parent may also have more XML
135 * namespaces than a child, but the reverse is not permitted.)  The
136 * restriction is necessary to ensure that an SBML model has a consistent
137 * overall structure.  This requires callers to manage their objects
138 * carefully, but the benefit is increased flexibility in how models can be
139 * created by permitting callers to create objects bottom-up if desired.  In
140 * situations where objects are not yet attached to parents (e.g.,
141 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
142 * libSBML determine such things as whether it is valid to assign a
143 * particular value to an attribute.  For packages, this means that the 
144 * parent object to which this package element is being added must have
145 * been created with the package namespace, or that the package namespace
146 * was added to it, even if that parent is not a package object itself.
147   */ public
148 FbcAssociation(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
149    this(libsbmlJNI.new_FbcAssociation__SWIG_1(level, version), true);
150  }
151
152  
153/**
154   * Creates a new {@link FbcAssociation} with the given SBML Level, Version, and
155   * &ldquo;fbc&rdquo;package version.
156   <p>
157   * @param level a long integer, the SBML Level to assign to this
158   * {@link FbcAssociation}.
159   <p>
160   * @param version a long integer, the SBML Version to assign to this
161   * {@link FbcAssociation}.
162   <p>
163   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
164   * Version to assign to this {@link FbcAssociation}.
165   <p>
166   * <p>
167 * @note Attempting to add an object to an {@link SBMLDocument} having a different
168 * combination of SBML Level, Version and XML namespaces than the object
169 * itself will result in an error at the time a caller attempts to make the
170 * addition.  A parent object must have compatible Level, Version and XML
171 * namespaces.  (Strictly speaking, a parent may also have more XML
172 * namespaces than a child, but the reverse is not permitted.)  The
173 * restriction is necessary to ensure that an SBML model has a consistent
174 * overall structure.  This requires callers to manage their objects
175 * carefully, but the benefit is increased flexibility in how models can be
176 * created by permitting callers to create objects bottom-up if desired.  In
177 * situations where objects are not yet attached to parents (e.g.,
178 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
179 * libSBML determine such things as whether it is valid to assign a
180 * particular value to an attribute.  For packages, this means that the 
181 * parent object to which this package element is being added must have
182 * been created with the package namespace, or that the package namespace
183 * was added to it, even if that parent is not a package object itself.
184   */ public
185 FbcAssociation(long level) throws org.sbml.libsbml.SBMLConstructorException {
186    this(libsbmlJNI.new_FbcAssociation__SWIG_2(level), true);
187  }
188
189  
190/**
191   * Creates a new {@link FbcAssociation} with the given SBML Level, Version, and
192   * &ldquo;fbc&rdquo;package version.
193   <p>
194   * @param level a long integer, the SBML Level to assign to this
195   * {@link FbcAssociation}.
196   <p>
197   * @param version a long integer, the SBML Version to assign to this
198   * {@link FbcAssociation}.
199   <p>
200   * @param pkgVersion a long integer, the SBML &ldquo;fbc&rdquo; package
201   * Version to assign to this {@link FbcAssociation}.
202   <p>
203   * <p>
204 * @note Attempting to add an object to an {@link SBMLDocument} having a different
205 * combination of SBML Level, Version and XML namespaces than the object
206 * itself will result in an error at the time a caller attempts to make the
207 * addition.  A parent object must have compatible Level, Version and XML
208 * namespaces.  (Strictly speaking, a parent may also have more XML
209 * namespaces than a child, but the reverse is not permitted.)  The
210 * restriction is necessary to ensure that an SBML model has a consistent
211 * overall structure.  This requires callers to manage their objects
212 * carefully, but the benefit is increased flexibility in how models can be
213 * created by permitting callers to create objects bottom-up if desired.  In
214 * situations where objects are not yet attached to parents (e.g.,
215 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
216 * libSBML determine such things as whether it is valid to assign a
217 * particular value to an attribute.  For packages, this means that the 
218 * parent object to which this package element is being added must have
219 * been created with the package namespace, or that the package namespace
220 * was added to it, even if that parent is not a package object itself.
221   */ public
222 FbcAssociation() throws org.sbml.libsbml.SBMLConstructorException {
223    this(libsbmlJNI.new_FbcAssociation__SWIG_3(), true);
224  }
225
226  
227/**
228   * Creates a new {@link FbcAssociation} with the given {@link FbcPkgNamespaces} object.
229   <p>
230   * <p>
231 * The package namespaces object used in this constructor is derived from a
232 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
233 * information.  It is used to communicate the SBML Level, Version, and 
234 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
235 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
236 * package namespace object somewhere in a program once, then hand that object
237 * as needed to object constructors of that package that accept it as and
238 * argument, such as this one.
239   <p>
240   * @param fbcns the {@link FbcPkgNamespaces} object.
241   <p>
242   * <p>
243 * @note Attempting to add an object to an {@link SBMLDocument} having a different
244 * combination of SBML Level, Version and XML namespaces than the object
245 * itself will result in an error at the time a caller attempts to make the
246 * addition.  A parent object must have compatible Level, Version and XML
247 * namespaces.  (Strictly speaking, a parent may also have more XML
248 * namespaces than a child, but the reverse is not permitted.)  The
249 * restriction is necessary to ensure that an SBML model has a consistent
250 * overall structure.  This requires callers to manage their objects
251 * carefully, but the benefit is increased flexibility in how models can be
252 * created by permitting callers to create objects bottom-up if desired.  In
253 * situations where objects are not yet attached to parents (e.g.,
254 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
255 * libSBML determine such things as whether it is valid to assign a
256 * particular value to an attribute.  For packages, this means that the 
257 * parent object to which this package element is being added must have
258 * been created with the package namespace, or that the package namespace
259 * was added to it, even if that parent is not a package object itself.
260   */ public
261 FbcAssociation(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
262    this(libsbmlJNI.new_FbcAssociation__SWIG_4(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
263  }
264
265  
266/**
267   * Copy constructor for {@link FbcAssociation}.
268   <p>
269   * @param orig the {@link FbcAssociation} instance to copy.
270   */ public
271 FbcAssociation(FbcAssociation orig) throws org.sbml.libsbml.SBMLConstructorException {
272    this(libsbmlJNI.new_FbcAssociation__SWIG_5(FbcAssociation.getCPtr(orig), orig), true);
273  }
274
275  
276/**
277   * Creates and returns a deep copy of this {@link FbcAssociation} object.
278   <p>
279   * @return a (deep) copy of this {@link FbcAssociation} object.
280   */ public
281 FbcAssociation cloneObject() {
282    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAssociation_cloneObject(swigCPtr, this), true);
283}
284
285  
286/**
287   * Returns <code>true</code>, if this abstract {@link FbcAssociation} is of type {@link FbcAnd}.
288   <p>
289   * @return <code>true</code>, if this abstract {@link FbcAssociation} is of type {@link FbcAnd}.
290   */ public
291 boolean isFbcAnd() {
292    return libsbmlJNI.FbcAssociation_isFbcAnd(swigCPtr, this);
293  }
294
295  
296/**
297   * Returns <code>true</code>, if this abstract {@link FbcAssociation} is of type {@link FbcOr}.
298   <p>
299   * @return <code>true</code>, if this abstract {@link FbcAssociation} is of type {@link FbcOr}.
300   */ public
301 boolean isFbcOr() {
302    return libsbmlJNI.FbcAssociation_isFbcOr(swigCPtr, this);
303  }
304
305  
306/**
307   * Returns <code>true</code>, if this abstract {@link FbcAssociation} is of type
308   * {@link GeneProductRef}.
309   <p>
310   * @return <code>true</code>, if this abstract {@link FbcAssociation} is of type
311   * {@link GeneProductRef}.
312   */ public
313 boolean isGeneProductRef() {
314    return libsbmlJNI.FbcAssociation_isGeneProductRef(swigCPtr, this);
315  }
316
317  
318/**
319   * Returns the XML element name of this object.
320   <p>
321   * For {@link FbcAssociation}, the XML element name is always <code>'fbcAssociation'.</code>
322   <p>
323   * @return the name of this element, i.e. <code>'fbcAssociation'.</code>
324   */ public
325 String getElementName() {
326    return libsbmlJNI.FbcAssociation_getElementName(swigCPtr, this);
327  }
328
329  
330/**
331   * Returns the libSBML type code for this SBML object.
332   <p>
333   * <p>
334 * LibSBML attaches an identifying code to every kind of SBML object.  These
335 * are integer constants known as <em>SBML type codes</em>.  The names of all
336 * the codes begin with the characters <code>SBML_</code>.
337 * In the Java language interface for libSBML, the
338 * type codes are defined as static integer constants in the interface class
339 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
340 * package plug-ins may use overlapping type codes; to identify the package
341 * to which a given object belongs, call the <code>getPackageName()</code>
342 * method on the object.
343   <p>
344   * @return the SBML type code for this object:
345   * {@link libsbmlConstants#SBML_FBC_ASSOCIATION SBML_FBC_ASSOCIATION} (default).
346   <p>
347   * <p>
348 * @warning <span class='warning'>The specific integer values of the possible
349 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
350 * packages,  To fully identify the correct code, <strong>it is necessary to
351 * invoke both getTypeCode() and getPackageName()</strong>.</span>
352   <p>
353   * @see #getElementName()
354   * @see #getPackageName()
355   */ public
356 int getTypeCode() {
357    return libsbmlJNI.FbcAssociation_getTypeCode(swigCPtr, this);
358  }
359
360  
361/**
362   * Predicate returning <code>true</code> if all the required attributes
363   * for this {@link FbcAssociation} object have been set.
364   <p>
365   * @note {@link FbcAssociation} has no required attributes, so this
366   * method always returns <code>true.</code>
367   <p>
368   * @return a boolean value indicating whether all the required
369   * attributes for this object have been defined.
370   */ public
371 boolean hasRequiredAttributes() {
372    return libsbmlJNI.FbcAssociation_hasRequiredAttributes(swigCPtr, this);
373  }
374
375  
376/**
377  * Parses a gene association in infix format and returns a corresponding
378  * {@link Association} object.
379  <p>
380  * This parses a string that has a list of gene names and conjunctions
381  * or disjunctions.  For example:
382  * <pre class='fragment'>
383  (b2422) and (b2425) and (b2423) and (b2424) or (b2422) and (b2423) and (b2424) and (b2413) and (b3917)
384</pre>
385  <p>
386  * The 'and' operator takes precedence over the 'or' operator, meaning that
387  * the above input string would turn into two groups of gene names: either
388  * 'b2422, b2425, b2423, and b2424' or 'b2422, b2423, b2424, b2413, and b3917'.
389  * Parentheses may be added to make things more clear, and to encode
390  * alternative schemes.
391  <p>
392  * This method also creates missing {@link GeneProduct} objects, in case the unique
393  * reference does not yet exist.
394  <p>
395  * @param association the string to parse.
396  * @param plugin the {@link FbcModelPlugin} on which to add the geneProduct elements.
397  * @param usingId boolean indicating whether the infix assumes identifiers (<code>true</code>)
398  * or labels (<code>false</code> default).
399  * @param addMissingGP boolean indicating whether to add missing geneProducts 
400  * (<code>true</code> default) or not (<code>false</code>).
401  <p>
402  * @return the parsed association, or <code>null</code> in case of an error.
403  <p>
404  * 
405  */ public
406 static FbcAssociation parseFbcInfixAssociation(String association, FbcModelPlugin plugin, boolean usingId, boolean addMissingGP) {
407    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAssociation_parseFbcInfixAssociation__SWIG_0(association, FbcModelPlugin.getCPtr(plugin), plugin, usingId, addMissingGP), false);
408}
409
410  
411/**
412  * Parses a gene association in infix format and returns a corresponding
413  * {@link Association} object.
414  <p>
415  * This parses a string that has a list of gene names and conjunctions
416  * or disjunctions.  For example:
417  * <pre class='fragment'>
418  (b2422) and (b2425) and (b2423) and (b2424) or (b2422) and (b2423) and (b2424) and (b2413) and (b3917)
419</pre>
420  <p>
421  * The 'and' operator takes precedence over the 'or' operator, meaning that
422  * the above input string would turn into two groups of gene names: either
423  * 'b2422, b2425, b2423, and b2424' or 'b2422, b2423, b2424, b2413, and b3917'.
424  * Parentheses may be added to make things more clear, and to encode
425  * alternative schemes.
426  <p>
427  * This method also creates missing {@link GeneProduct} objects, in case the unique
428  * reference does not yet exist.
429  <p>
430  * @param association the string to parse.
431  * @param plugin the {@link FbcModelPlugin} on which to add the geneProduct elements.
432  * @param usingId boolean indicating whether the infix assumes identifiers (<code>true</code>)
433  * or labels (<code>false</code> default).
434  * @param addMissingGP boolean indicating whether to add missing geneProducts 
435  * (<code>true</code> default) or not (<code>false</code>).
436  <p>
437  * @return the parsed association, or <code>null</code> in case of an error.
438  <p>
439  * 
440  */ public
441 static FbcAssociation parseFbcInfixAssociation(String association, FbcModelPlugin plugin, boolean usingId) {
442    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAssociation_parseFbcInfixAssociation__SWIG_1(association, FbcModelPlugin.getCPtr(plugin), plugin, usingId), false);
443}
444
445  
446/**
447  * Parses a gene association in infix format and returns a corresponding
448  * {@link Association} object.
449  <p>
450  * This parses a string that has a list of gene names and conjunctions
451  * or disjunctions.  For example:
452  * <pre class='fragment'>
453  (b2422) and (b2425) and (b2423) and (b2424) or (b2422) and (b2423) and (b2424) and (b2413) and (b3917)
454</pre>
455  <p>
456  * The 'and' operator takes precedence over the 'or' operator, meaning that
457  * the above input string would turn into two groups of gene names: either
458  * 'b2422, b2425, b2423, and b2424' or 'b2422, b2423, b2424, b2413, and b3917'.
459  * Parentheses may be added to make things more clear, and to encode
460  * alternative schemes.
461  <p>
462  * This method also creates missing {@link GeneProduct} objects, in case the unique
463  * reference does not yet exist.
464  <p>
465  * @param association the string to parse.
466  * @param plugin the {@link FbcModelPlugin} on which to add the geneProduct elements.
467  * @param usingId boolean indicating whether the infix assumes identifiers (<code>true</code>)
468  * or labels (<code>false</code> default).
469  * @param addMissingGP boolean indicating whether to add missing geneProducts 
470  * (<code>true</code> default) or not (<code>false</code>).
471  <p>
472  * @return the parsed association, or <code>null</code> in case of an error.
473  <p>
474  * 
475  */ public
476 static FbcAssociation parseFbcInfixAssociation(String association, FbcModelPlugin plugin) {
477    return (FbcAssociation) libsbml.DowncastSBase(libsbmlJNI.FbcAssociation_parseFbcInfixAssociation__SWIG_2(association, FbcModelPlugin.getCPtr(plugin), plugin), false);
478}
479
480  
481/**
482  * Converts this {@link FbcAssociation} object into an infix string representation.
483  <p>
484  * @return the association as infix string.
485  */ public
486 String toInfix(boolean usingId) {
487    return libsbmlJNI.FbcAssociation_toInfix__SWIG_0(swigCPtr, this, usingId);
488  }
489
490  
491/**
492  * Converts this {@link FbcAssociation} object into an infix string representation.
493  <p>
494  * @return the association as infix string.
495  */ public
496 String toInfix() {
497    return libsbmlJNI.FbcAssociation_toInfix__SWIG_1(swigCPtr, this);
498  }
499
500  
501/** * @internal */ public
502 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
503    libsbmlJNI.FbcAssociation_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
504  }
505
506}