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 Annotation helper class for &ldquo;fbc&rdquo; Version&nbsp;1.
014 <p>
015 * <p style='color: #777; font-style: italic'>
016This class of objects is defined by libSBML only and has no direct
017equivalent in terms of SBML components.  This class is not prescribed by
018the SBML specifications, although it is used to implement features
019defined in SBML.
020</p>
021
022 <p>
023 * The {@link Association} class is a helper class for creating annotations to store
024 * gene association information in Version&nbsp;1 of the SBML Level&nbsp;3
025 * <a href='../../../extensions-summary.html#fbc'>Flux Balance Constraints</a> (&ldquo;fbc&rdquo;) package.  In &ldquo;fbc&rdquo;
026 * Version&nbsp;2, the equivalent capability is handled by the {@link FbcAssociation}
027 * class and this class (Association) is not used.
028 <p>
029 * @see FbcAssociation
030 * @see ListOfFbcAssociations
031 */
032
033public class Association extends SBase {
034   private long swigCPtr;
035
036   protected Association(long cPtr, boolean cMemoryOwn)
037   {
038     super(libsbmlJNI.Association_SWIGUpcast(cPtr), cMemoryOwn);
039     swigCPtr = cPtr;
040   }
041
042   protected static long getCPtr(Association obj)
043   {
044     return (obj == null) ? 0 : obj.swigCPtr;
045   }
046
047   protected static long getCPtrAndDisown (Association obj)
048   {
049     long ptr = 0;
050
051     if (obj != null)
052     {
053       ptr             = obj.swigCPtr;
054       obj.swigCMemOwn = false;
055     }
056
057     return ptr;
058   }
059
060  protected void finalize() {
061    delete();
062  }
063
064  public synchronized void delete() {
065    if (swigCPtr != 0) {
066      if (swigCMemOwn) {
067        swigCMemOwn = false;
068        libsbmlJNI.delete_Association(swigCPtr);
069      }
070      swigCPtr = 0;
071    }
072    super.delete();
073  }
074
075  
076/**
077   * Creates a new {@link Association} objet with the given SBML Level, Version, and
078   * &ldquo;fbc&rdquo; package version.
079   */ public
080 Association(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
081    this(libsbmlJNI.new_Association__SWIG_0(level, version, pkgVersion), true);
082  }
083
084  
085/**
086   * Creates a new {@link Association} objet with the given SBML Level, Version, and
087   * &ldquo;fbc&rdquo; package version.
088   */ public
089 Association(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
090    this(libsbmlJNI.new_Association__SWIG_1(level, version), true);
091  }
092
093  
094/**
095   * Creates a new {@link Association} objet with the given SBML Level, Version, and
096   * &ldquo;fbc&rdquo; package version.
097   */ public
098 Association(long level) throws org.sbml.libsbml.SBMLConstructorException {
099    this(libsbmlJNI.new_Association__SWIG_2(level), true);
100  }
101
102  
103/**
104   * Creates a new {@link Association} objet with the given SBML Level, Version, and
105   * &ldquo;fbc&rdquo; package version.
106   */ public
107 Association() throws org.sbml.libsbml.SBMLConstructorException {
108    this(libsbmlJNI.new_Association__SWIG_3(), true);
109  }
110
111  
112/** */ public
113 Association(XMLNode node, FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
114    this(libsbmlJNI.new_Association__SWIG_4(XMLNode.getCPtr(node), node, FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
115  }
116
117  
118/**
119   * Creates a new {@link Association} with the given {@link FbcPkgNamespaces} object.
120   */ public
121 Association(FbcPkgNamespaces fbcns) throws org.sbml.libsbml.SBMLConstructorException {
122    this(libsbmlJNI.new_Association__SWIG_5(FbcPkgNamespaces.getCPtr(fbcns), fbcns), true);
123  }
124
125  
126/**
127   * Copy constructor.
128   */ public
129 Association(Association source) throws org.sbml.libsbml.SBMLConstructorException {
130    this(libsbmlJNI.new_Association__SWIG_6(Association.getCPtr(source), source), true);
131  }
132
133  
134/**
135   * Returns the string of the 'type' attribute of this {@link Association} object.
136   <p>
137   * @return the string of the 'type' attribute of this {@link Association} object.
138   */ public
139 int getType() {
140    return libsbmlJNI.Association_getType(swigCPtr, this);
141  }
142
143  
144/**
145   * Predicate returning <code>true</code> if this {@link Association}'s 'type' attribute is
146   * set.
147   <p>
148   * @return <code>true</code> if this {@link Association} object's 'type' attribute has been set,
149   * otherwise <code>false</code> is returned.
150   */ public
151 boolean isSetType() {
152    return libsbmlJNI.Association_isSetType(swigCPtr, this);
153  }
154
155  
156/**
157   * Sets the SIdRef string of the 'type' attribute of this {@link Association} object.
158   <p>
159   * @param type a SIdRef string to be set.
160   <p>
161   * <p>
162 * @return integer value indicating success/failure of the
163 * function.   The possible values
164 * returned by this function are:
165   * <ul>
166   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
167   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
168   * </ul>
169   */ public
170 int setType(int type) {
171    return libsbmlJNI.Association_setType(swigCPtr, this, type);
172  }
173
174  
175/**
176   * Unsets the value of the 'id' attribute of this {@link Association} object.
177   <p>
178   * <p>
179 * @return integer value indicating success/failure of the
180 * function.   The possible values
181 * returned by this function are:
182   * <ul>
183   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
184   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
185   * </ul>
186   */ public
187 int unsetType() {
188    return libsbmlJNI.Association_unsetType(swigCPtr, this);
189  }
190
191  
192/**
193   * Returns the string of the 'reference' attribute of this {@link Association} object.
194   <p>
195   * @return the string of the 'reference' attribute of this {@link Association} object.
196   */ public
197 String getReference() {
198    return libsbmlJNI.Association_getReference(swigCPtr, this);
199  }
200
201  
202/**
203   * Predicate returning <code>true</code> if this {@link Association}'s 'reference' attribute
204   * has been set.
205   <p>
206   * @return <code>true</code> if this {@link Association} object's 'reference' attribute has been set,
207   * otherwise <code>false</code> is returned.
208   */ public
209 boolean isSetReference() {
210    return libsbmlJNI.Association_isSetReference(swigCPtr, this);
211  }
212
213  
214/**
215   * Sets the SIdRef string of the 'reference' attribute of this {@link Association} object.
216   <p>
217   * @param reference a SIdRef string to be set.
218   <p>
219   * <p>
220 * @return integer value indicating success/failure of the
221 * function.   The possible values
222 * returned by this function are:
223   * <ul>
224   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
225   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
226   * </ul>
227   */ public
228 int setReference(String reference) {
229    return libsbmlJNI.Association_setReference(swigCPtr, this, reference);
230  }
231
232  
233/**
234   * Unsets the value of the 'id' attribute of this {@link Association} object.
235   <p>
236   * <p>
237 * @return integer value indicating success/failure of the
238 * function.   The possible values
239 * returned by this function are:
240   * <ul>
241   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
242   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
243   * </ul>
244   */ public
245 int unsetReference() {
246    return libsbmlJNI.Association_unsetReference(swigCPtr, this);
247  }
248
249  
250/**
251   * Adds a gene with the given <code>id</code> to the association.
252   <p>
253   * @param id the gene name.
254   <p>
255   * <p>
256 * @return integer value indicating success/failure of the
257 * function.   The possible values
258 * returned by this function are:
259   * <ul>
260   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
261   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
262   * </ul>
263   */ public
264 int addGene(String id) {
265    return libsbmlJNI.Association_addGene(swigCPtr, this, id);
266  }
267
268  
269/**
270   * Returns the number of child Associations of this {@link Association} object.
271   <p>
272   * @return the number of associations.
273   */ public
274 long getNumAssociations() {
275    return libsbmlJNI.Association_getNumAssociations(swigCPtr, this);
276  }
277
278  
279/**
280   * Adds a child {@link Association} to this {@link Association} object.
281   <p>
282   * @param association the {@link Association} object to add. 
283   <p>
284   * <p>
285 * @return integer value indicating success/failure of the
286 * function.   The possible values
287 * returned by this function are:
288   * <ul>
289   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
290   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
291   * </ul>
292   */ public
293 int addAssociation(Association association) {
294    return libsbmlJNI.Association_addAssociation(swigCPtr, this, Association.getCPtr(association), association);
295  }
296
297  
298/**
299   * Removes the child Associations with the given <code>index</code> from this
300   * {@link Association} object.
301   <p>
302   * @param index the index number of the item to remove
303   <p>
304   * <p>
305 * @return integer value indicating success/failure of the
306 * function.   The possible values
307 * returned by this function are:
308   * <ul>
309   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
310   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
311   * </ul>
312   */ public
313 int removeAssociation(int index) {
314    return libsbmlJNI.Association_removeAssociation(swigCPtr, this, index);
315  }
316
317  
318/**
319   * Removes all children of this {@link Association} object.
320   <p>
321   * <p>
322 * @return integer value indicating success/failure of the
323 * function.   The possible values
324 * returned by this function are:
325   * <ul>
326   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
327   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
328   * </ul>
329   */ public
330 int clearAssociations() {
331    return libsbmlJNI.Association_clearAssociations(swigCPtr, this);
332  }
333
334  
335/**
336   * Creates a new {@link Association} of type 'and'.
337   <p>
338   * This method does not actually add the created {@link Association} as a child of
339   * this {@link Association} object or do anything else with it&mdash;the returning
340   * pointer is now owned by the caller.
341   <p>
342   * @return a new 'and' type association.
343   */ public
344 Association createAnd() {
345    long cPtr = libsbmlJNI.Association_createAnd(swigCPtr, this);
346    return (cPtr == 0) ? null : new Association(cPtr, false);
347  }
348
349  
350/**
351   * Creates a new {@link Association} of type 'or'.
352   <p>
353   * This method does not actually add the created {@link Association} as a child of
354   * this {@link Association} object or do anything else with it&mdash;the returning
355   * pointer is now owned by the caller.
356   <p>
357   * @return a new 'or' type association.
358   */ public
359 Association createOr() {
360    long cPtr = libsbmlJNI.Association_createOr(swigCPtr, this);
361    return (cPtr == 0) ? null : new Association(cPtr, false);
362  }
363
364  
365/**
366   * Creates a new {@link Association} of type 'and' with a given gene reference.
367   <p>
368   * This method does not actually add the created {@link Association} as a child of
369   * this {@link Association} object or do anything else with it&mdash;the returning
370   * pointer is now owned by the caller.
371   <p>
372   * @param reference the gene reference, as a string
373   <p>
374   * @return a new {@link Association} object.
375   */ public
376 Association createGene(String reference) {
377    long cPtr = libsbmlJNI.Association_createGene__SWIG_0(swigCPtr, this, reference);
378    return (cPtr == 0) ? null : new Association(cPtr, false);
379  }
380
381  
382/**
383   * Creates a new {@link Association} of type 'and' with a given gene reference.
384   <p>
385   * This method does not actually add the created {@link Association} as a child of
386   * this {@link Association} object or do anything else with it&mdash;the returning
387   * pointer is now owned by the caller.
388   <p>
389   * @param reference the gene reference, as a string
390   <p>
391   * @return a new {@link Association} object.
392   */ public
393 Association createGene() {
394    long cPtr = libsbmlJNI.Association_createGene__SWIG_1(swigCPtr, this);
395    return (cPtr == 0) ? null : new Association(cPtr, false);
396  }
397
398  
399/**
400   * Creates an {@link XMLNode} object from this {@link Association} object.
401   */ public
402 XMLNode toXML() {
403    return new XMLNode(libsbmlJNI.Association_toXML(swigCPtr, this), true);
404  }
405
406  
407/**
408   * Returns the XML element name of this SBML object.
409   <p>
410   * @return the name of this element, as a text string.
411   */ public
412 String getElementName() {
413    return libsbmlJNI.Association_getElementName(swigCPtr, this);
414  }
415
416  
417/**
418   * Creates and returns a deep copy of this {@link Association} object.
419   <p>
420   * @return a (deep) copy of this {@link Association} object.
421   */ public
422 Association cloneObject() {
423    long cPtr = libsbmlJNI.Association_cloneObject(swigCPtr, this);
424    return (cPtr == 0) ? null : new Association(cPtr, true);
425  }
426
427  
428/**
429   * Returns the libSBML type code of this object instance.
430   <p>
431   * <p>
432 * LibSBML attaches an identifying code to every kind of SBML object.  These
433 * are integer constants known as <em>SBML type codes</em>.  The names of all
434 * the codes begin with the characters <code>SBML_</code>.
435 * In the Java language interface for libSBML, the
436 * type codes are defined as static integer constants in the interface class
437 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
438 * package plug-ins may use overlapping type codes; to identify the package
439 * to which a given object belongs, call the <code>getPackageName()</code>
440 * method on the object.
441   <p>
442   * @return the SBML type code for this object:
443   * {@link libsbmlConstants#SBML_FBC_ASSOCIATION SBML_FBC_ASSOCIATION}
444   <p>
445   * <p>
446 * @warning <span class='warning'>The specific integer values of the possible
447 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
448 * packages,  To fully identify the correct code, <strong>it is necessary to
449 * invoke both getTypeCode() and getPackageName()</strong>.</span>
450   <p>
451   * @see #getElementName()
452   * @see #getPackageName()
453   */ public
454 int getTypeCode() {
455    return libsbmlJNI.Association_getTypeCode(swigCPtr, this);
456  }
457
458  
459/**
460   * Parses a gene association in infix format and returns a corresponding
461   * {@link Association} object.
462   <p>
463   * This parses a string that has a list of gene names and conjunctions
464   * or disjunctions.  For example:
465   * <pre class='fragment'>
466(b2422) and (b2425) and (b2423) and (b2424) or (b2422) and (b2423) and (b2424) and (b2413) and (b3917)
467</pre>
468   <p>
469   * @param association the string to parse.
470   <p>
471   * @return the parsed association, or <code>null</code> in case of an error.
472   <p>
473   * 
474   */ public
475 static Association parseInfixAssociation(String association) {
476    long cPtr = libsbmlJNI.Association_parseInfixAssociation(association);
477    return (cPtr == 0) ? null : new Association(cPtr, false);
478  }
479
480  
481/**
482   * Converts this {@link Association} object into an infix string representation.
483   <p>
484   * @return the association as infix string.
485   */ public
486 String toInfix() {
487    return libsbmlJNI.Association_toInfix(swigCPtr, this);
488  }
489
490}