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