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-qual"><a href="group__qual.html">qual</a></span>
013
014 A function term.
015 <p>
016 * Each {@link FunctionTerm} is associated with a result and with a Boolean function
017 * inside a Math element that can be used to set the conditions under which
018 * this term is selected.
019 */
020
021public class FunctionTerm extends SBase {
022   private long swigCPtr;
023
024   protected FunctionTerm(long cPtr, boolean cMemoryOwn)
025   {
026     super(libsbmlJNI.FunctionTerm_SWIGUpcast(cPtr), cMemoryOwn);
027     swigCPtr = cPtr;
028   }
029
030   protected static long getCPtr(FunctionTerm obj)
031   {
032     return (obj == null) ? 0 : obj.swigCPtr;
033   }
034
035   protected static long getCPtrAndDisown (FunctionTerm obj)
036   {
037     long ptr = 0;
038
039     if (obj != null)
040     {
041       ptr             = obj.swigCPtr;
042       obj.swigCMemOwn = false;
043     }
044
045     return ptr;
046   }
047
048  protected void finalize() {
049    delete();
050  }
051
052  public synchronized void delete() {
053    if (swigCPtr != 0) {
054      if (swigCMemOwn) {
055        swigCMemOwn = false;
056        libsbmlJNI.delete_FunctionTerm(swigCPtr);
057      }
058      swigCPtr = 0;
059    }
060    super.delete();
061  }
062
063  
064/**
065   * Creates a new {@link FunctionTerm} with the given level, version, and package version.
066   <p>
067   * @param level a long integer, the SBML Level to assign to this {@link FunctionTerm}
068   <p>
069   * @param version a long integer, the SBML Version to assign to this {@link FunctionTerm}
070   <p>
071   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link FunctionTerm}
072   */ public
073 FunctionTerm(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
074    this(libsbmlJNI.new_FunctionTerm__SWIG_0(level, version, pkgVersion), true);
075  }
076
077  
078/**
079   * Creates a new {@link FunctionTerm} with the given level, version, and package version.
080   <p>
081   * @param level a long integer, the SBML Level to assign to this {@link FunctionTerm}
082   <p>
083   * @param version a long integer, the SBML Version to assign to this {@link FunctionTerm}
084   <p>
085   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link FunctionTerm}
086   */ public
087 FunctionTerm(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
088    this(libsbmlJNI.new_FunctionTerm__SWIG_1(level, version), true);
089  }
090
091  
092/**
093   * Creates a new {@link FunctionTerm} with the given level, version, and package version.
094   <p>
095   * @param level a long integer, the SBML Level to assign to this {@link FunctionTerm}
096   <p>
097   * @param version a long integer, the SBML Version to assign to this {@link FunctionTerm}
098   <p>
099   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link FunctionTerm}
100   */ public
101 FunctionTerm(long level) throws org.sbml.libsbml.SBMLConstructorException {
102    this(libsbmlJNI.new_FunctionTerm__SWIG_2(level), true);
103  }
104
105  
106/**
107   * Creates a new {@link FunctionTerm} with the given level, version, and package version.
108   <p>
109   * @param level a long integer, the SBML Level to assign to this {@link FunctionTerm}
110   <p>
111   * @param version a long integer, the SBML Version to assign to this {@link FunctionTerm}
112   <p>
113   * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link FunctionTerm}
114   */ public
115 FunctionTerm() throws org.sbml.libsbml.SBMLConstructorException {
116    this(libsbmlJNI.new_FunctionTerm__SWIG_3(), true);
117  }
118
119  
120/**
121   * Creates a new {@link FunctionTerm} with the given {@link QualPkgNamespaces} object.
122   <p>
123   * @param qualns the {@link QualPkgNamespaces} object
124   */ public
125 FunctionTerm(QualPkgNamespaces qualns) throws org.sbml.libsbml.SBMLConstructorException {
126    this(libsbmlJNI.new_FunctionTerm__SWIG_4(QualPkgNamespaces.getCPtr(qualns), qualns), true);
127  }
128
129  
130/**
131   * Copy constructor for {@link FunctionTerm}.
132   <p>
133   * @param orig the {@link FunctionTerm} instance to copy.
134   */ public
135 FunctionTerm(FunctionTerm orig) throws org.sbml.libsbml.SBMLConstructorException {
136    this(libsbmlJNI.new_FunctionTerm__SWIG_5(FunctionTerm.getCPtr(orig), orig), true);
137  }
138
139  
140/**
141   * Creates and returns a deep copy of this {@link FunctionTerm} object.
142   <p>
143   * @return a (deep) copy of this {@link FunctionTerm} object.
144   */ public
145 FunctionTerm cloneObject() {
146    long cPtr = libsbmlJNI.FunctionTerm_cloneObject(swigCPtr, this);
147    return (cPtr == 0) ? null : new FunctionTerm(cPtr, true);
148  }
149
150  
151/**
152   * Returns the value of the 'resultLevel' attribute of this {@link FunctionTerm}.
153   <p>
154   * @return the value of the 'resultLevel' attribute of this {@link FunctionTerm} as a integer.
155   */ public
156 int getResultLevel() {
157    return libsbmlJNI.FunctionTerm_getResultLevel(swigCPtr, this);
158  }
159
160  
161/**
162   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
163   * {@link FunctionTerm}'s 'resultLevel' attribute has been set.
164   <p>
165   * @return <code>true</code> if this {@link FunctionTerm}'s 'resultLevel' attribute has been set,
166   * otherwise <code>false</code> is returned.
167   */ public
168 boolean isSetResultLevel() {
169    return libsbmlJNI.FunctionTerm_isSetResultLevel(swigCPtr, this);
170  }
171
172  
173/**
174   * Sets the value of the 'resultLevel' attribute of this {@link FunctionTerm}.
175   <p>
176   * @param resultLevel int value of the 'resultLevel' attribute to be set
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_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
185   * </ul>
186   */ public
187 int setResultLevel(int resultLevel) {
188    return libsbmlJNI.FunctionTerm_setResultLevel(swigCPtr, this, resultLevel);
189  }
190
191  
192/**
193   * Unsets the value of the 'resultLevel' attribute of this {@link FunctionTerm}.
194   <p>
195   * <p>
196 * @return integer value indicating success/failure of the
197 * function.   The possible values
198 * returned by this function are:
199   * <ul>
200   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
201   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
202   * </ul>
203   */ public
204 int unsetResultLevel() {
205    return libsbmlJNI.FunctionTerm_unsetResultLevel(swigCPtr, this);
206  }
207
208  
209/**
210   * Returns the 'math' element of this {@link FunctionTerm}.
211   <p>
212   * @return the 'math' element of this {@link FunctionTerm}.
213   */ public
214 ASTNode getMath() {
215    long cPtr = libsbmlJNI.FunctionTerm_getMath(swigCPtr, this);
216    return (cPtr == 0) ? null : new ASTNode(cPtr, false);
217  }
218
219  
220/**
221   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
222   * {@link FunctionTerm}'s 'math' element has been set.
223   <p>
224   * @return <code>true</code> if this {@link FunctionTerm}'s 'math' element has been set,
225   * otherwise <code>false</code> is returned.
226   */ public
227 boolean isSetMath() {
228    return libsbmlJNI.FunctionTerm_isSetMath(swigCPtr, this);
229  }
230
231  
232/**
233   * Sets the 'math' element of this {@link FunctionTerm}.
234   <p>
235   * @param math {@link ASTNode}  math of the 'resultLevel' attribute to be set
236   <p>
237   * <p>
238 * @return integer value indicating success/failure of the
239 * function.   The possible values
240 * returned by this function are:
241   * <ul>
242   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
243   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
244   * </ul>
245   */ public
246 int setMath(ASTNode math) {
247    return libsbmlJNI.FunctionTerm_setMath(swigCPtr, this, ASTNode.getCPtr(math), math);
248  }
249
250  
251/**
252   * Unsets the 'math' element of this {@link FunctionTerm}.
253   <p>
254   * <p>
255 * @return integer value indicating success/failure of the
256 * function.   The possible values
257 * returned by this function are:
258   * <ul>
259   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
260   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
261   * </ul>
262   */ public
263 int unsetMath() {
264    return libsbmlJNI.FunctionTerm_unsetMath(swigCPtr, this);
265  }
266
267  
268/**
269   * <p>
270 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
271 * value.
272 <p>
273 * <p>
274 * In SBML, object identifiers are of a data type called <code>SId</code>.
275 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
276 * introduced for attribute values that refer to <code>SId</code> values; in
277 * previous Levels of SBML, this data type did not exist and attributes were
278 * simply described to as 'referring to an identifier', but the effective
279 * data type was the same as <code>SIdRef</code>in Level&nbsp;3.  These and
280 * other methods of libSBML refer to the type <code>SIdRef</code> for all
281 * Levels of SBML, even if the corresponding SBML specification did not
282 * explicitly name the data type.
283 <p>
284 * This method works by looking at all attributes and (if appropriate)
285 * mathematical formulas in MathML content, comparing the referenced
286 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
287 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
288 * descend into child elements.
289 <p>
290 * @param oldid the old identifier
291 * @param newid the new identifier
292   */ public
293 void renameSIdRefs(String oldid, String newid) {
294    libsbmlJNI.FunctionTerm_renameSIdRefs(swigCPtr, this, oldid, newid);
295  }
296
297  
298/**
299   * Returns the XML name of this object.
300   <p>
301   * @return the name of this element.
302   */ public
303 String getElementName() {
304    return libsbmlJNI.FunctionTerm_getElementName(swigCPtr, this);
305  }
306
307  
308/**
309   * Returns the libSBML type code of this object instance.
310   <p>
311   * <p>
312 * LibSBML attaches an identifying code to every kind of SBML object.  These
313 * are integer constants known as <em>SBML type codes</em>.  The names of all
314 * the codes begin with the characters <code>SBML_</code>.
315 * In the Java language interface for libSBML, the
316 * type codes are defined as static integer constants in the interface class
317 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
318 * package plug-ins may use overlapping type codes; to identify the package
319 * to which a given object belongs, call the <code>getPackageName()</code>
320 * method on the object.
321   <p>
322   * @return the SBML type code for this object:
323   * {@link libsbmlConstants#SBML_QUAL_FUNCTION_TERM SBML_QUAL_FUNCTION_TERM}
324   <p>
325   * <p>
326 * @warning <span class='warning'>The specific integer values of the possible
327 * type codes may be reused by different Level&nbsp;3 package plug-ins.
328 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
329 * both getTypeCode() and getPackageName()</strong>.</span>
330   <p>
331   * @see #getElementName()
332   * @see #getPackageName()
333   */ public
334 int getTypeCode() {
335    return libsbmlJNI.FunctionTerm_getTypeCode(swigCPtr, this);
336  }
337
338  
339/**
340   * Predicate returning <code>true</code> if all the required attributes
341   * for this {@link FunctionTerm} object have been set.
342   <p>
343   * @note The required attributes for a {@link FunctionTerm} object are:
344   <p>
345   * @return a boolean value indicating whether all the required
346   * attributes for this object have been defined.
347   */ public
348 boolean hasRequiredAttributes() {
349    return libsbmlJNI.FunctionTerm_hasRequiredAttributes(swigCPtr, this);
350  }
351
352  
353/**
354   * Predicate returning <code>true</code> if all the required elements
355   * for this {@link FunctionTerm} object have been set.
356   <p>
357   * @note The required elements for a {@link FunctionTerm} object are:
358   * <ul>
359   * <li> 'math'
360   *
361   * </ul> <p>
362   * @return a boolean value indicating whether all the required
363   * elements for this object have been defined.
364   */ public
365 boolean hasRequiredElements() {
366    return libsbmlJNI.FunctionTerm_hasRequiredElements(swigCPtr, this);
367  }
368
369  
370/** * @internal */ public
371 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
372    libsbmlJNI.FunctionTerm_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
373  }
374
375}