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