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-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 <p> 073 * <p> 074 * @note Attempting to add an object to an {@link SBMLDocument} having a different 075 * combination of SBML Level, Version and XML namespaces than the object 076 * itself will result in an error at the time a caller attempts to make the 077 * addition. A parent object must have compatible Level, Version and XML 078 * namespaces. (Strictly speaking, a parent may also have more XML 079 * namespaces than a child, but the reverse is not permitted.) The 080 * restriction is necessary to ensure that an SBML model has a consistent 081 * overall structure. This requires callers to manage their objects 082 * carefully, but the benefit is increased flexibility in how models can be 083 * created by permitting callers to create objects bottom-up if desired. In 084 * situations where objects are not yet attached to parents (e.g., 085 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 086 * libSBML determine such things as whether it is valid to assign a 087 * particular value to an attribute. For packages, this means that the 088 * parent object to which this package element is being added must have 089 * been created with the package namespace, or that the package namespace 090 * was added to it, even if that parent is not a package object itself. 091 */ public 092 FunctionTerm(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 093 this(libsbmlJNI.new_FunctionTerm__SWIG_0(level, version, pkgVersion), true); 094 } 095 096 097/** 098 * Creates a new {@link FunctionTerm} with the given level, version, and package version. 099 <p> 100 * @param level a long integer, the SBML Level to assign to this {@link FunctionTerm}. 101 <p> 102 * @param version a long integer, the SBML Version to assign to this {@link FunctionTerm}. 103 <p> 104 * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link FunctionTerm}. 105 <p> 106 * <p> 107 * @note Attempting to add an object to an {@link SBMLDocument} having a different 108 * combination of SBML Level, Version and XML namespaces than the object 109 * itself will result in an error at the time a caller attempts to make the 110 * addition. A parent object must have compatible Level, Version and XML 111 * namespaces. (Strictly speaking, a parent may also have more XML 112 * namespaces than a child, but the reverse is not permitted.) The 113 * restriction is necessary to ensure that an SBML model has a consistent 114 * overall structure. This requires callers to manage their objects 115 * carefully, but the benefit is increased flexibility in how models can be 116 * created by permitting callers to create objects bottom-up if desired. In 117 * situations where objects are not yet attached to parents (e.g., 118 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 119 * libSBML determine such things as whether it is valid to assign a 120 * particular value to an attribute. For packages, this means that the 121 * parent object to which this package element is being added must have 122 * been created with the package namespace, or that the package namespace 123 * was added to it, even if that parent is not a package object itself. 124 */ public 125 FunctionTerm(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 126 this(libsbmlJNI.new_FunctionTerm__SWIG_1(level, version), true); 127 } 128 129 130/** 131 * Creates a new {@link FunctionTerm} with the given level, version, and package version. 132 <p> 133 * @param level a long integer, the SBML Level to assign to this {@link FunctionTerm}. 134 <p> 135 * @param version a long integer, the SBML Version to assign to this {@link FunctionTerm}. 136 <p> 137 * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link FunctionTerm}. 138 <p> 139 * <p> 140 * @note Attempting to add an object to an {@link SBMLDocument} having a different 141 * combination of SBML Level, Version and XML namespaces than the object 142 * itself will result in an error at the time a caller attempts to make the 143 * addition. A parent object must have compatible Level, Version and XML 144 * namespaces. (Strictly speaking, a parent may also have more XML 145 * namespaces than a child, but the reverse is not permitted.) The 146 * restriction is necessary to ensure that an SBML model has a consistent 147 * overall structure. This requires callers to manage their objects 148 * carefully, but the benefit is increased flexibility in how models can be 149 * created by permitting callers to create objects bottom-up if desired. In 150 * situations where objects are not yet attached to parents (e.g., 151 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 152 * libSBML determine such things as whether it is valid to assign a 153 * particular value to an attribute. For packages, this means that the 154 * parent object to which this package element is being added must have 155 * been created with the package namespace, or that the package namespace 156 * was added to it, even if that parent is not a package object itself. 157 */ public 158 FunctionTerm(long level) throws org.sbml.libsbml.SBMLConstructorException { 159 this(libsbmlJNI.new_FunctionTerm__SWIG_2(level), true); 160 } 161 162 163/** 164 * Creates a new {@link FunctionTerm} with the given level, version, and package version. 165 <p> 166 * @param level a long integer, the SBML Level to assign to this {@link FunctionTerm}. 167 <p> 168 * @param version a long integer, the SBML Version to assign to this {@link FunctionTerm}. 169 <p> 170 * @param pkgVersion a long integer, the SBML Qual Version to assign to this {@link FunctionTerm}. 171 <p> 172 * <p> 173 * @note Attempting to add an object to an {@link SBMLDocument} having a different 174 * combination of SBML Level, Version and XML namespaces than the object 175 * itself will result in an error at the time a caller attempts to make the 176 * addition. A parent object must have compatible Level, Version and XML 177 * namespaces. (Strictly speaking, a parent may also have more XML 178 * namespaces than a child, but the reverse is not permitted.) The 179 * restriction is necessary to ensure that an SBML model has a consistent 180 * overall structure. This requires callers to manage their objects 181 * carefully, but the benefit is increased flexibility in how models can be 182 * created by permitting callers to create objects bottom-up if desired. In 183 * situations where objects are not yet attached to parents (e.g., 184 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 185 * libSBML determine such things as whether it is valid to assign a 186 * particular value to an attribute. For packages, this means that the 187 * parent object to which this package element is being added must have 188 * been created with the package namespace, or that the package namespace 189 * was added to it, even if that parent is not a package object itself. 190 */ public 191 FunctionTerm() throws org.sbml.libsbml.SBMLConstructorException { 192 this(libsbmlJNI.new_FunctionTerm__SWIG_3(), true); 193 } 194 195 196/** 197 * Creates a new {@link FunctionTerm} with the given {@link QualPkgNamespaces} object. 198 <p> 199 * <p> 200 * The package namespaces object used in this constructor is derived from a 201 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 202 * information. It is used to communicate the SBML Level, Version, and 203 * package version and name information used in addition to SBML Level 3 Core. A 204 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 205 * package namespace object somewhere in a program once, then hand that object 206 * as needed to object constructors of that package that accept it as and 207 * argument, such as this one. 208 <p> 209 * @param qualns the {@link QualPkgNamespaces} object. 210 <p> 211 * <p> 212 * @note Attempting to add an object to an {@link SBMLDocument} having a different 213 * combination of SBML Level, Version and XML namespaces than the object 214 * itself will result in an error at the time a caller attempts to make the 215 * addition. A parent object must have compatible Level, Version and XML 216 * namespaces. (Strictly speaking, a parent may also have more XML 217 * namespaces than a child, but the reverse is not permitted.) The 218 * restriction is necessary to ensure that an SBML model has a consistent 219 * overall structure. This requires callers to manage their objects 220 * carefully, but the benefit is increased flexibility in how models can be 221 * created by permitting callers to create objects bottom-up if desired. In 222 * situations where objects are not yet attached to parents (e.g., 223 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 224 * libSBML determine such things as whether it is valid to assign a 225 * particular value to an attribute. For packages, this means that the 226 * parent object to which this package element is being added must have 227 * been created with the package namespace, or that the package namespace 228 * was added to it, even if that parent is not a package object itself. 229 */ public 230 FunctionTerm(QualPkgNamespaces qualns) throws org.sbml.libsbml.SBMLConstructorException { 231 this(libsbmlJNI.new_FunctionTerm__SWIG_4(QualPkgNamespaces.getCPtr(qualns), qualns), true); 232 } 233 234 235/** 236 * Copy constructor for {@link FunctionTerm}. 237 <p> 238 * @param orig the {@link FunctionTerm} instance to copy. 239 */ public 240 FunctionTerm(FunctionTerm orig) throws org.sbml.libsbml.SBMLConstructorException { 241 this(libsbmlJNI.new_FunctionTerm__SWIG_5(FunctionTerm.getCPtr(orig), orig), true); 242 } 243 244 245/** 246 * Creates and returns a deep copy of this {@link FunctionTerm} object. 247 <p> 248 * @return a (deep) copy of this {@link FunctionTerm} object. 249 */ public 250 FunctionTerm cloneObject() { 251 long cPtr = libsbmlJNI.FunctionTerm_cloneObject(swigCPtr, this); 252 return (cPtr == 0) ? null : new FunctionTerm(cPtr, true); 253 } 254 255 256/** 257 * Returns the value of the 'resultLevel' attribute of this {@link FunctionTerm}. 258 <p> 259 * @return the value of the 'resultLevel' attribute of this {@link FunctionTerm} as a integer. 260 */ public 261 int getResultLevel() { 262 return libsbmlJNI.FunctionTerm_getResultLevel(swigCPtr, this); 263 } 264 265 266/** 267 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 268 * {@link FunctionTerm}'s 'resultLevel' attribute has been set. 269 <p> 270 * @return <code>true</code> if this {@link FunctionTerm}'s 'resultLevel' attribute has been set, 271 * otherwise <code>false</code> is returned. 272 */ public 273 boolean isSetResultLevel() { 274 return libsbmlJNI.FunctionTerm_isSetResultLevel(swigCPtr, this); 275 } 276 277 278/** 279 * Sets the value of the 'resultLevel' attribute of this {@link FunctionTerm}. 280 <p> 281 * @param resultLevel int value of the 'resultLevel' attribute to be set. 282 <p> 283 * <p> 284 * @return integer value indicating success/failure of the 285 * function. The possible values 286 * returned by this function are: 287 * <ul> 288 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 289 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 290 * </ul> 291 */ public 292 int setResultLevel(int resultLevel) { 293 return libsbmlJNI.FunctionTerm_setResultLevel(swigCPtr, this, resultLevel); 294 } 295 296 297/** 298 * Unsets the value of the 'resultLevel' attribute of this {@link FunctionTerm}. 299 <p> 300 * <p> 301 * @return integer value indicating success/failure of the 302 * function. The possible values 303 * returned by this function are: 304 * <ul> 305 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 306 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 307 * </ul> 308 */ public 309 int unsetResultLevel() { 310 return libsbmlJNI.FunctionTerm_unsetResultLevel(swigCPtr, this); 311 } 312 313 314/** 315 * Returns the 'math' element of this {@link FunctionTerm}. 316 <p> 317 * @return the 'math' element of this {@link FunctionTerm}, or <code>null</code> if the math is not set. 318 */ public 319 ASTNode getMath() { 320 long cPtr = libsbmlJNI.FunctionTerm_getMath(swigCPtr, this); 321 return (cPtr == 0) ? null : new ASTNode(cPtr, false); 322 } 323 324 325/** 326 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 327 * {@link FunctionTerm}'s 'math' element has been set. 328 <p> 329 * @return <code>true</code> if this {@link FunctionTerm}'s 'math' element has been set, 330 * otherwise <code>false</code> is returned. 331 */ public 332 boolean isSetMath() { 333 return libsbmlJNI.FunctionTerm_isSetMath(swigCPtr, this); 334 } 335 336 337/** 338 * Sets the 'math' element of this {@link FunctionTerm}. 339 <p> 340 * @param math {@link ASTNode} math of the 'resultLevel' attribute to be set. 341 <p> 342 * <p> 343 * @return integer value indicating success/failure of the 344 * function. The possible values 345 * returned by this function are: 346 * <ul> 347 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 348 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 349 * </ul> 350 */ public 351 int setMath(ASTNode math) { 352 return libsbmlJNI.FunctionTerm_setMath(swigCPtr, this, ASTNode.getCPtr(math), math); 353 } 354 355 356/** 357 * Unsets the 'math' element of this {@link FunctionTerm}. 358 <p> 359 * <p> 360 * @return integer value indicating success/failure of the 361 * function. The possible values 362 * returned by this function are: 363 * <ul> 364 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 365 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 366 * </ul> 367 */ public 368 int unsetMath() { 369 return libsbmlJNI.FunctionTerm_unsetMath(swigCPtr, this); 370 } 371 372 373/** 374 * <p> 375 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another 376 * value. 377 <p> 378 * <p> 379 * In SBML, object identifiers are of a data type called <code>SId</code>. 380 * In SBML Level 3, an explicit data type called <code>SIdRef</code> was 381 * introduced for attribute values that refer to <code>SId</code> values; in 382 * previous Levels of SBML, this data type did not exist and attributes were 383 * simply described to as 'referring to an identifier', but the effective 384 * data type was the same as <code>SIdRef</code> in Level 3. These and 385 * other methods of libSBML refer to the type <code>SIdRef</code> for all 386 * Levels of SBML, even if the corresponding SBML specification did not 387 * explicitly name the data type. 388 <p> 389 * This method works by looking at all attributes and (if appropriate) 390 * mathematical formulas in MathML content, comparing the referenced 391 * identifiers to the value of <code>oldid</code>. If any matches are found, the 392 * matching values are replaced with <code>newid</code>. The method does <em>not</em> 393 * descend into child elements. 394 <p> 395 * @param oldid the old identifier. 396 * @param newid the new identifier. 397 */ public 398 void renameSIdRefs(String oldid, String newid) { 399 libsbmlJNI.FunctionTerm_renameSIdRefs(swigCPtr, this, oldid, newid); 400 } 401 402 403/** 404 * Returns the XML name of this object. 405 <p> 406 * @return the name of this element. 407 */ public 408 String getElementName() { 409 return libsbmlJNI.FunctionTerm_getElementName(swigCPtr, this); 410 } 411 412 413/** 414 * Returns the libSBML type code of this object instance. 415 <p> 416 * <p> 417 * LibSBML attaches an identifying code to every kind of SBML object. These 418 * are integer constants known as <em>SBML type codes</em>. The names of all 419 * the codes begin with the characters <code>SBML_</code>. 420 * In the Java language interface for libSBML, the 421 * type codes are defined as static integer constants in the interface class 422 * {@link libsbmlConstants}. Note that different Level 3 423 * package plug-ins may use overlapping type codes; to identify the package 424 * to which a given object belongs, call the <code>getPackageName()</code> 425 * method on the object. 426 <p> 427 * @return the SBML type code for this object: 428 * {@link libsbmlConstants#SBML_QUAL_FUNCTION_TERM SBML_QUAL_FUNCTION_TERM} 429 <p> 430 * <p> 431 * @warning <span class='warning'>The specific integer values of the possible 432 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 433 * packages, To fully identify the correct code, <strong>it is necessary to 434 * invoke both getTypeCode() and getPackageName()</strong>.</span> 435 <p> 436 * @see #getElementName() 437 * @see #getPackageName() 438 */ public 439 int getTypeCode() { 440 return libsbmlJNI.FunctionTerm_getTypeCode(swigCPtr, this); 441 } 442 443 444/** 445 * Predicate returning <code>true</code> if all the required attributes 446 * for this {@link FunctionTerm} object have been set. 447 <p> 448 * @note The required attributes for a {@link FunctionTerm} object are: 449 <p> 450 * @return a boolean value indicating whether all the required 451 * attributes for this object have been defined. 452 */ public 453 boolean hasRequiredAttributes() { 454 return libsbmlJNI.FunctionTerm_hasRequiredAttributes(swigCPtr, this); 455 } 456 457 458/** 459 * Predicate returning <code>true</code> if all the required elements 460 * for this {@link FunctionTerm} object have been set. 461 <p> 462 * @note The required elements for a {@link FunctionTerm} object are: 463 * <ul> 464 * <li> 'math' 465 * 466 * </ul> <p> 467 * @return a boolean value indicating whether all the required 468 * elements for this object have been defined. 469 */ public 470 boolean hasRequiredElements() { 471 return libsbmlJNI.FunctionTerm_hasRequiredElements(swigCPtr, this); 472 } 473 474 475/** * @internal */ public 476 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 477 libsbmlJNI.FunctionTerm_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 478 } 479 480}