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 * The rate expression for an SBML reaction. 013 <p> 014 * An object of class {@link KineticLaw} is used to describe the rate at which the 015 * process defined by a given {@link Reaction} takes place. {@link KineticLaw} has 016 * subelements called 'math' (for MathML content) and 'listOfParameters' 017 * (of class {@link ListOfParameters}), in addition to the attributes and 018 * subelements it inherits from {@link SBase}. 019 <p> 020 * {@link KineticLaw}'s 'math' subelement for holding a MathML formula (required 021 * through SBML Level 3 Version 1, but optional as of SBML 022 * Level 3 Version 2) defines the 023 * rate of the reaction. The formula may refer to other entities in a 024 * model as well as local parameter definitions within the scope of the 025 * {@link Reaction} (see below). It is important to keep in mind, however, that 026 * the only {@link Species} identifiers that can be used in this formula are those 027 * declared in the lists of reactants, products and modifiers in the 028 * {@link Reaction} structure. (In other words, before a species can be referenced 029 * in the {@link KineticLaw}, it must be declared in one of those lists.) 030 <p> 031 * {@link KineticLaw} provides a way to define <em>local</em> parameters whose 032 * identifiers can be used in the 'math' formula of that {@link KineticLaw} 033 * instance. Prior to SBML Level 3, these parameter definitions are 034 * stored inside a 'listOfParameters' subelement containing {@link Parameter} 035 * objects; in SBML Level 3, this is achieved using a specialized 036 * object class called {@link LocalParameter} and the containing subelement is 037 * called 'listOfLocalParameters'. In both cases, the parameters so 038 * defined are only visible within the {@link KineticLaw} (or, as of SBML 039 * Level 3 Version 2, only visible within the parent {@link Reaction}); 040 * they cannot be accessed 041 * outside. A local parameter within one reaction is not visible from 042 * within another reaction, nor is it visible to any other construct 043 * outside of the {@link KineticLaw} in which it is defined. In addition, another 044 * important feature is that if such a {@link Parameter} (or in Level 3, 045 * {@link LocalParameter}) object has the same identifier as another object in the 046 * scope of the enclosing {@link Model}, the definition inside the {@link KineticLaw} takes 047 * precedence. In other words, within the {@link KineticLaw}'s 'math' formula, 048 * references to local parameter identifiers <strong>shadow any identical 049 * global identifiers</strong>. 050 <p> 051 * The values of local parameters defined within {@link KineticLaw} objects cannot 052 * change. In SBML Level 3, this quality is built into the 053 * {@link LocalParameter} construct. In Level 2, where the same kind of 054 * {@link Parameter} object class is used as for global parameters, the {@link Parameter} 055 * objects' 'constant' attribute must always have a value of <code>true</code> 056 * (either explicitly or left to its default value). 057 <p> 058 * <h2>A warning about identifier shadowing</h2> 059 <p> 060 * A common misconception is that different classes of objects (e.g., 061 * species, compartments, parameters) in SBML have different identifier 062 * scopes. They do not. The implication is that if a {@link KineticLaw}'s local 063 * parameter definition uses an identifier identical to <em>any</em> other 064 * identifier defined in the model outside the {@link KineticLaw}, even if the 065 * other identifier does <em>not</em> belong to a parameter type of object, the 066 * local parameter's identifier takes precedence within that {@link KineticLaw}'s 067 * 'math' formula. It is not an error in SBML for identifiers to shadow 068 * each other this way, but can lead to confusing and subtle errors. 069 <p> 070 * <h2>SBML Level/Version differences</h2> 071 <p> 072 * In SBML Level 2 Version 1, the SBML specification 073 * included two additional attributes on {@link KineticLaw} called 'substanceUnits' 074 * and 'timeUnits'. They were removed beginning with SBML Level 2 075 * Version 2 because further research determined they introduced many 076 * problems. The most significant problem was that their use could easily 077 * lead to the creation of valid models whose reactions nevertheless could 078 * not be integrated into a system of equations without outside knowledge 079 * for converting the quantities used. Examination of real-life models 080 * revealed that a common reason for using 'substanceUnits' on {@link KineticLaw} 081 * was to set the units of all reactions to the same set of substance 082 * units, something that is better achieved by using {@link UnitDefinition} to 083 * redefine <code>'substance'</code> for the whole {@link Model}. 084 <p> 085 * As mentioned above, in SBML Level 2 Versions 2–4, local 086 * parameters are of class {@link Parameter}. In SBML Level 3, the class of 087 * object is {@link LocalParameter}. 088 <p> 089 * In SBML Level 3 Version 2, the scope of the {@link LocalParameter} 090 * was expanded to the entire {@link Reaction}, instead of just the {@link KineticLaw}. 091 * This introduced a single new restriction: an L3v2 {@link LocalParameter} may 092 * not now shadow the <code>id</code> of any {@link Species} referenced by a {@link SpeciesReference} 093 * in the same {@link Reaction}. Other than that, there is no difference in any 094 * core construct. However, packages may take advantage of this new scope by 095 * adding elements to the {@link Reaction} that may now reference a {@link LocalParameter} 096 * defined in the same {@link Reaction}. 097 */ 098 099public class KineticLaw extends SBase { 100 private long swigCPtr; 101 102 protected KineticLaw(long cPtr, boolean cMemoryOwn) 103 { 104 super(libsbmlJNI.KineticLaw_SWIGUpcast(cPtr), cMemoryOwn); 105 swigCPtr = cPtr; 106 } 107 108 protected static long getCPtr(KineticLaw obj) 109 { 110 return (obj == null) ? 0 : obj.swigCPtr; 111 } 112 113 protected static long getCPtrAndDisown (KineticLaw obj) 114 { 115 long ptr = 0; 116 117 if (obj != null) 118 { 119 ptr = obj.swigCPtr; 120 obj.swigCMemOwn = false; 121 } 122 123 return ptr; 124 } 125 126 protected void finalize() { 127 delete(); 128 } 129 130 public synchronized void delete() { 131 if (swigCPtr != 0) { 132 if (swigCMemOwn) { 133 swigCMemOwn = false; 134 libsbmlJNI.delete_KineticLaw(swigCPtr); 135 } 136 swigCPtr = 0; 137 } 138 super.delete(); 139 } 140 141 142/** 143 * Creates a new {@link KineticLaw} using the given SBML <code>level</code> and <code>version</code> 144 * values. 145 <p> 146 * @param level a long integer, the SBML Level to assign to this {@link KineticLaw}. 147 <p> 148 * @param version a long integer, the SBML Version to assign to this 149 * {@link KineticLaw}. 150 <p> 151 * <p> 152 * @throws SBMLConstructorException 153 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid 154 * or if this object is incompatible with the given level and version. 155 <p> 156 * <p> 157 * @note Attempting to add an object to an {@link SBMLDocument} having a different 158 * combination of SBML Level, Version and XML namespaces than the object 159 * itself will result in an error at the time a caller attempts to make the 160 * addition. A parent object must have compatible Level, Version and XML 161 * namespaces. (Strictly speaking, a parent may also have more XML 162 * namespaces than a child, but the reverse is not permitted.) The 163 * restriction is necessary to ensure that an SBML model has a consistent 164 * overall structure. This requires callers to manage their objects 165 * carefully, but the benefit is increased flexibility in how models can be 166 * created by permitting callers to create objects bottom-up if desired. In 167 * situations where objects are not yet attached to parents (e.g., 168 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 169 * libSBML determine such things as whether it is valid to assign a 170 * particular value to an attribute. 171 */ public 172 KineticLaw(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 173 this(libsbmlJNI.new_KineticLaw__SWIG_0(level, version), true); 174 } 175 176 177/** 178 * Creates a new {@link KineticLaw} using the given {@link SBMLNamespaces} object 179 * <code>sbmlns</code>. 180 <p> 181 * <p> 182 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 183 * information. It is used to communicate the SBML Level, Version, and (in 184 * Level 3) packages used in addition to SBML Level 3 Core. A 185 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 186 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 187 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 188 <p> 189 * @param sbmlns an {@link SBMLNamespaces} object. 190 <p> 191 * <p> 192 * @throws SBMLConstructorException 193 * Thrown if the given <code>sbmlns</code> is inconsistent or incompatible 194 * with this object. 195 <p> 196 * <p> 197 * @note Attempting to add an object to an {@link SBMLDocument} having a different 198 * combination of SBML Level, Version and XML namespaces than the object 199 * itself will result in an error at the time a caller attempts to make the 200 * addition. A parent object must have compatible Level, Version and XML 201 * namespaces. (Strictly speaking, a parent may also have more XML 202 * namespaces than a child, but the reverse is not permitted.) The 203 * restriction is necessary to ensure that an SBML model has a consistent 204 * overall structure. This requires callers to manage their objects 205 * carefully, but the benefit is increased flexibility in how models can be 206 * created by permitting callers to create objects bottom-up if desired. In 207 * situations where objects are not yet attached to parents (e.g., 208 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 209 * libSBML determine such things as whether it is valid to assign a 210 * particular value to an attribute. 211 */ public 212 KineticLaw(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 213 this(libsbmlJNI.new_KineticLaw__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 214 } 215 216 217/** 218 * Copy constructor; creates a copy of this {@link KineticLaw}. 219 <p> 220 * @param orig the object to copy. 221 */ public 222 KineticLaw(KineticLaw orig) throws org.sbml.libsbml.SBMLConstructorException { 223 this(libsbmlJNI.new_KineticLaw__SWIG_2(KineticLaw.getCPtr(orig), orig), true); 224 } 225 226 227/** 228 * Creates and returns a deep copy of this {@link KineticLaw} object. 229 <p> 230 * @return the (deep) copy of this {@link KineticLaw} object. 231 */ public 232 KineticLaw cloneObject() { 233 long cPtr = libsbmlJNI.KineticLaw_cloneObject(swigCPtr, this); 234 return (cPtr == 0) ? null : new KineticLaw(cPtr, true); 235 } 236 237 238/** 239 * Returns the first child element found that has the given <code>id</code> in the 240 * model-wide SId namespace, or <code>null</code> if no such object is found. 241 <p> 242 * @param id string representing the id of the object to find. 243 <p> 244 * @return pointer to the first element found with the given <code>id</code>. 245 */ public 246 SBase getElementBySId(String id) { 247 return libsbml.DowncastSBase(libsbmlJNI.KineticLaw_getElementBySId(swigCPtr, this, id), false); 248} 249 250 251/** 252 * Returns the first child element it can find with the given <code>metaid</code>, or 253 * <code>null</code> if no such object is found. 254 <p> 255 * @param metaid string representing the metaid of the object to find. 256 <p> 257 * @return pointer to the first element found with the given <code>metaid</code>. 258 */ public 259 SBase getElementByMetaId(String metaid) { 260 return libsbml.DowncastSBase(libsbmlJNI.KineticLaw_getElementByMetaId(swigCPtr, this, metaid), false); 261} 262 263 264/** 265 * Returns the mathematical formula for this {@link KineticLaw} object and return 266 * it as as a text string. 267 <p> 268 * This is fundamentally equivalent to 269 * {@link KineticLaw#getMath()}. 270 * This variant is provided principally for compatibility compatibility 271 * with SBML Level 1. 272 <p> 273 * @return a string representing the formula of this {@link KineticLaw}. 274 <p> 275 * @note SBML Level 1 uses a text-string format for mathematical formulas. 276SBML Level 2 uses MathML, an XML format for representing mathematical 277expressions. LibSBML provides an Abstract Syntax Tree API for working with 278mathematical expressions; this API is more powerful than working with 279formulas directly in text form, and ASTs can be translated into either 280MathML or the text-string syntax. The libSBML methods that accept 281text-string formulas directly (such as this constructor) are provided for 282SBML Level 1 compatibility, but developers are encouraged to use the 283AST mechanisms. 284 285 <p> 286 * @see #getMath() 287 */ public 288 String getFormula() { 289 return libsbmlJNI.KineticLaw_getFormula(swigCPtr, this); 290 } 291 292 293/** 294 * Returns the mathematical formula for this {@link KineticLaw} object and return 295 * it as as an AST. 296 <p> 297 * This is fundamentally equivalent to 298 * {@link KineticLaw#getFormula()}. 299 * The latter is provided principally for compatibility compatibility 300 * with SBML Level 1, which represented mathematical formulas in 301 * text-string form. 302 <p> 303 * @return the {@link ASTNode} representation of the mathematical formula, 304 * or null if the math is not set. 305 <p> 306 * @see #getFormula() 307 */ public 308 ASTNode getMath() { 309 long cPtr = libsbmlJNI.KineticLaw_getMath(swigCPtr, this); 310 return (cPtr == 0) ? null : new ASTNode(cPtr, false); 311 } 312 313 314/** 315 * (SBML Level 2 Version 1 only) Returns the value of the 316 * 'timeUnits' attribute of this {@link KineticLaw} object. 317 <p> 318 * @return the 'timeUnits' attribute value. 319 <p> 320 * <p> 321 * @note The attributes 'timeUnits' and 'substanceUnits' are present only 322 * in SBML Level 2 Version 1. In SBML Level 2 323 * Version 2, the 'timeUnits' and 'substanceUnits' attributes were 324 * removed. For compatibility with new versions of SBML, users are 325 * cautioned to avoid these attributes. 326 */ public 327 String getTimeUnits() { 328 return libsbmlJNI.KineticLaw_getTimeUnits(swigCPtr, this); 329 } 330 331 332/** 333 * (SBML Level 2 Version 1 only) Returns the value of the 334 * 'substanceUnits' attribute of this {@link KineticLaw} object. 335 <p> 336 * @return the 'substanceUnits' attribute value. 337 <p> 338 * <p> 339 * @note The attributes 'timeUnits' and 'substanceUnits' are present only 340 * in SBML Level 2 Version 1. In SBML Level 2 341 * Version 2, the 'timeUnits' and 'substanceUnits' attributes were 342 * removed. For compatibility with new versions of SBML, users are 343 * cautioned to avoid these attributes. 344 */ public 345 String getSubstanceUnits() { 346 return libsbmlJNI.KineticLaw_getSubstanceUnits(swigCPtr, this); 347 } 348 349 350/** 351 * Predicate returning <code>true</code> if this {@link KineticLaw}'s 'formula' attribute is 352 * set. 353 <p> 354 * This is functionally identical to the method 355 * {@link KineticLaw#isSetMath()}. It is 356 * provided in order to mirror the parallel between 357 * {@link KineticLaw#getFormula()} and 358 * {@link KineticLaw#getMath()}. 359 <p> 360 * @return <code>true</code> if the formula (meaning the <code>math</code> subelement) of 361 * this {@link KineticLaw} is set, <code>false</code> otherwise. 362 <p> 363 * @note SBML Level 1 uses a text-string format for mathematical formulas. 364SBML Level 2 uses MathML, an XML format for representing mathematical 365expressions. LibSBML provides an Abstract Syntax Tree API for working with 366mathematical expressions; this API is more powerful than working with 367formulas directly in text form, and ASTs can be translated into either 368MathML or the text-string syntax. The libSBML methods that accept 369text-string formulas directly (such as this constructor) are provided for 370SBML Level 1 compatibility, but developers are encouraged to use the 371AST mechanisms. 372 373 <p> 374 * @see #isSetMath() 375 */ public 376 boolean isSetFormula() { 377 return libsbmlJNI.KineticLaw_isSetFormula(swigCPtr, this); 378 } 379 380 381/** 382 * Predicate returning <code>true</code> if this Kinetic's 'math' subelement is set. 383 <p> 384 * This is identical to the method 385 * {@link KineticLaw#isSetFormula()}. 386 * It is provided in order to mirror the parallel between 387 * {@link KineticLaw#getFormula()} and 388 * {@link KineticLaw#getMath()}. 389 <p> 390 * @return <code>true</code> if the formula (meaning the <code>math</code> subelement) of 391 * this {@link KineticLaw} is set, <code>false</code> otherwise. 392 <p> 393 * @see #isSetFormula() 394 */ public 395 boolean isSetMath() { 396 return libsbmlJNI.KineticLaw_isSetMath(swigCPtr, this); 397 } 398 399 400/** 401 * (SBML Level 2 Version 1 only) Predicate returning <code>true</code> if 402 * this {@link SpeciesReference}'s 'timeUnits' attribute is set. 403 <p> 404 * @return <code>true</code> if the 'timeUnits' attribute of this {@link KineticLaw} object 405 * is set, <code>false</code> otherwise. 406 <p> 407 * <p> 408 * @note The attributes 'timeUnits' and 'substanceUnits' are present only 409 * in SBML Level 2 Version 1. In SBML Level 2 410 * Version 2, the 'timeUnits' and 'substanceUnits' attributes were 411 * removed. For compatibility with new versions of SBML, users are 412 * cautioned to avoid these attributes. 413 */ public 414 boolean isSetTimeUnits() { 415 return libsbmlJNI.KineticLaw_isSetTimeUnits(swigCPtr, this); 416 } 417 418 419/** 420 * (SBML Level 2 Version 1 only) Predicate returning <code>true</code> if 421 * this {@link SpeciesReference}'s 'substanceUnits' attribute is set. 422 <p> 423 * @return <code>true</code> if the 'substanceUnits' attribute of this {@link KineticLaw} 424 * object is set, <code>false</code> otherwise. 425 <p> 426 * <p> 427 * @note The attributes 'timeUnits' and 'substanceUnits' are present only 428 * in SBML Level 2 Version 1. In SBML Level 2 429 * Version 2, the 'timeUnits' and 'substanceUnits' attributes were 430 * removed. For compatibility with new versions of SBML, users are 431 * cautioned to avoid these attributes. 432 */ public 433 boolean isSetSubstanceUnits() { 434 return libsbmlJNI.KineticLaw_isSetSubstanceUnits(swigCPtr, this); 435 } 436 437 438/** 439 * Sets the mathematical expression of this {@link KineticLaw} instance to the 440 * given <code>formula</code>. 441 <p> 442 * The given <code>formula</code> string is copied. Internally, libSBML stores the 443 * mathematical expression as an {@link ASTNode}. 444 <p> 445 * @param formula the mathematical expression to use, represented in 446 * text-string form. 447 <p> 448 * <p> 449 * @return integer value indicating success/failure of the 450 * function. The possible values 451 * returned by this function are: 452 * <ul> 453 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 454 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 455 * 456 * </ul> <p> 457 * @note SBML Level 1 uses a text-string format for mathematical formulas. 458SBML Level 2 uses MathML, an XML format for representing mathematical 459expressions. LibSBML provides an Abstract Syntax Tree API for working with 460mathematical expressions; this API is more powerful than working with 461formulas directly in text form, and ASTs can be translated into either 462MathML or the text-string syntax. The libSBML methods that accept 463text-string formulas directly (such as this constructor) are provided for 464SBML Level 1 compatibility, but developers are encouraged to use the 465AST mechanisms. 466 467 <p> 468 * @see #setMath(ASTNode math) 469 */ public 470 int setFormula(String formula) { 471 return libsbmlJNI.KineticLaw_setFormula(swigCPtr, this, formula); 472 } 473 474 475/** 476 * Sets the mathematical expression of this {@link KineticLaw} instance to a copy 477 * of the given {@link ASTNode}. 478 <p> 479 * This is fundamentally identical to 480 * {@link KineticLaw#setFormula(String formula)}. 481 * The latter is provided principally for compatibility compatibility with 482 * SBML Level 1, which represented mathematical formulas in text-string 483 * form. 484 <p> 485 * @param math an {@link ASTNode} representing a formula tree. 486 <p> 487 * <p> 488 * @return integer value indicating success/failure of the 489 * function. The possible values 490 * returned by this function are: 491 * <ul> 492 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 493 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 494 * 495 * </ul> <p> 496 * @see #setFormula(String formula) 497 */ public 498 int setMath(ASTNode math) { 499 return libsbmlJNI.KineticLaw_setMath(swigCPtr, this, ASTNode.getCPtr(math), math); 500 } 501 502 503/** 504 * (SBML Level 2 Version 1 only) Sets the 'timeUnits' attribute 505 * of this {@link KineticLaw} object to a copy of the identifier in <code>sid</code>. 506 <p> 507 * @param sid the identifier of the units to use. 508 <p> 509 * <p> 510 * @return integer value indicating success/failure of the 511 * function. The possible values 512 * returned by this function are: 513 * <ul> 514 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 515 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 516 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 517 * 518 * </ul> <p> 519 * <p> 520 * @note The attributes 'timeUnits' and 'substanceUnits' are present only 521 * in SBML Level 2 Version 1. In SBML Level 2 522 * Version 2, the 'timeUnits' and 'substanceUnits' attributes were 523 * removed. For compatibility with new versions of SBML, users are 524 * cautioned to avoid these attributes. 525 */ public 526 int setTimeUnits(String sid) { 527 return libsbmlJNI.KineticLaw_setTimeUnits(swigCPtr, this, sid); 528 } 529 530 531/** 532 * (SBML Level 2 Version 1 only) Sets the 'substanceUnits' 533 * attribute of this {@link KineticLaw} object to a copy of the identifier given 534 * in <code>sid</code>. 535 <p> 536 * @param sid the identifier of the units to use. 537 <p> 538 * <p> 539 * @return integer value indicating success/failure of the 540 * function. The possible values 541 * returned by this function are: 542 * <ul> 543 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 544 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 545 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 546 * 547 * </ul> <p> 548 * <p> 549 * @note The attributes 'timeUnits' and 'substanceUnits' are present only 550 * in SBML Level 2 Version 1. In SBML Level 2 551 * Version 2, the 'timeUnits' and 'substanceUnits' attributes were 552 * removed. For compatibility with new versions of SBML, users are 553 * cautioned to avoid these attributes. 554 */ public 555 int setSubstanceUnits(String sid) { 556 return libsbmlJNI.KineticLaw_setSubstanceUnits(swigCPtr, this, sid); 557 } 558 559 560/** 561 * (SBML Level 2 Version 1 only) Unsets the 'timeUnits' 562 * attribugte of this {@link KineticLaw} object. 563 <p> 564 * <p> 565 * @return integer value indicating success/failure of the 566 * function. The possible values 567 * returned by this function are: 568 * <ul> 569 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 570 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 571 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 572 * 573 * </ul> <p> 574 * <p> 575 * @note The attributes 'timeUnits' and 'substanceUnits' are present only 576 * in SBML Level 2 Version 1. In SBML Level 2 577 * Version 2, the 'timeUnits' and 'substanceUnits' attributes were 578 * removed. For compatibility with new versions of SBML, users are 579 * cautioned to avoid these attributes. 580 */ public 581 int unsetTimeUnits() { 582 return libsbmlJNI.KineticLaw_unsetTimeUnits(swigCPtr, this); 583 } 584 585 586/** 587 * (SBML Level 2 Version 1 only) Unsets the 'substanceUnits' 588 * attribute of this {@link KineticLaw} object. 589 <p> 590 * <p> 591 * @return integer value indicating success/failure of the 592 * function. The possible values 593 * returned by this function are: 594 * <ul> 595 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 596 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 597 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 598 * 599 * </ul> <p> 600 * <p> 601 * @note The attributes 'timeUnits' and 'substanceUnits' are present only 602 * in SBML Level 2 Version 1. In SBML Level 2 603 * Version 2, the 'timeUnits' and 'substanceUnits' attributes were 604 * removed. For compatibility with new versions of SBML, users are 605 * cautioned to avoid these attributes. 606 */ public 607 int unsetSubstanceUnits() { 608 return libsbmlJNI.KineticLaw_unsetSubstanceUnits(swigCPtr, this); 609 } 610 611 612/** 613 * Adds a copy of the given {@link Parameter} object to the list of local 614 * parameters in this {@link KineticLaw}. 615 <p> 616 * @param p the {@link Parameter} to add. 617 <p> 618 * <p> 619 * @return integer value indicating success/failure of the 620 * function. The possible values 621 * returned by this function are: 622 * <ul> 623 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 624 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 625 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 626 * <li> {@link libsbmlConstants#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID} 627 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 628 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 629 * 630 * </ul> <p> 631 * <p> 632 * @note This method should be used with some caution. The fact that this 633 * method <em>copies</em> the object passed to it means that the caller will be 634 * left holding a physically different object instance than the one contained 635 * inside this object. Changes made to the original object instance (such as 636 * resetting attribute values) will <em>not affect the instance in this 637 * object</em>. In addition, the caller should make sure to free the 638 * original object if it is no longer being used, or else a memory leak will 639 * result. Please see other methods on this class (particularly a 640 * corresponding method whose name begins with the word <code>create</code>) 641 * for alternatives that do not lead to these issues. 642 <p> 643 * @see #createParameter() 644 */ public 645 int addParameter(Parameter p) { 646 return libsbmlJNI.KineticLaw_addParameter(swigCPtr, this, Parameter.getCPtr(p), p); 647 } 648 649 650/** 651 * Adds a copy of the given {@link LocalParameter} object to the list of local 652 * parameters in this {@link KineticLaw}. 653 <p> 654 * @param p the {@link LocalParameter} to add. 655 <p> 656 * <p> 657 * @return integer value indicating success/failure of the 658 * function. The possible values 659 * returned by this function are: 660 * <ul> 661 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 662 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 663 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 664 * <li> {@link libsbmlConstants#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID} 665 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 666 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 667 * 668 * </ul> <p> 669 * <p> 670 * @note This method should be used with some caution. The fact that this 671 * method <em>copies</em> the object passed to it means that the caller will be 672 * left holding a physically different object instance than the one contained 673 * inside this object. Changes made to the original object instance (such as 674 * resetting attribute values) will <em>not affect the instance in this 675 * object</em>. In addition, the caller should make sure to free the 676 * original object if it is no longer being used, or else a memory leak will 677 * result. Please see other methods on this class (particularly a 678 * corresponding method whose name begins with the word <code>create</code>) 679 * for alternatives that do not lead to these issues. 680 <p> 681 * @see #createLocalParameter() 682 */ public 683 int addLocalParameter(LocalParameter p) { 684 return libsbmlJNI.KineticLaw_addLocalParameter(swigCPtr, this, LocalParameter.getCPtr(p), p); 685 } 686 687 688/** 689 * Creates a new {@link Parameter} object, adds it to this {@link KineticLaw}'s list of 690 * local parameters, and returns the {@link Parameter} object created. 691 <p> 692 * @return a new {@link Parameter} object instance. 693 <p> 694 * @see #addParameter(Parameter p) 695 */ public 696 Parameter createParameter() { 697 long cPtr = libsbmlJNI.KineticLaw_createParameter(swigCPtr, this); 698 return (cPtr == 0) ? null : new Parameter(cPtr, false); 699 } 700 701 702/** 703 * Creates a new {@link LocalParameter} object, adds it to this {@link KineticLaw}'s list 704 * of local parameters, and returns the {@link LocalParameter} object created. 705 <p> 706 * @return a new {@link LocalParameter} object instance. 707 <p> 708 * @see #addLocalParameter(LocalParameter p) 709 */ public 710 LocalParameter createLocalParameter() { 711 long cPtr = libsbmlJNI.KineticLaw_createLocalParameter(swigCPtr, this); 712 return (cPtr == 0) ? null : new LocalParameter(cPtr, false); 713 } 714 715 716/** 717 * Returns the list of local parameters in this {@link KineticLaw} object. 718 <p> 719 * @return the list of Parameters for this {@link KineticLaw}. 720 */ public 721 ListOfParameters getListOfParameters() { 722 long cPtr = libsbmlJNI.KineticLaw_getListOfParameters__SWIG_0(swigCPtr, this); 723 return (cPtr == 0) ? null : new ListOfParameters(cPtr, false); 724 } 725 726 727/** 728 * Returns the list of local parameters in this {@link KineticLaw} object. 729 <p> 730 * @return the list of LocalParameters for this {@link KineticLaw}. 731 */ public 732 ListOfLocalParameters getListOfLocalParameters() { 733 long cPtr = libsbmlJNI.KineticLaw_getListOfLocalParameters__SWIG_0(swigCPtr, this); 734 return (cPtr == 0) ? null : new ListOfLocalParameters(cPtr, false); 735 } 736 737 738/** 739 * Returns the nth {@link Parameter} object in the list of local parameters in 740 * this {@link KineticLaw} instance. 741 <p> 742 * @param n the index of the {@link Parameter} object sought. 743 <p> 744 * @return the nth {@link Parameter} of this {@link KineticLaw}. 745 */ public 746 Parameter getParameter(long n) { 747 long cPtr = libsbmlJNI.KineticLaw_getParameter__SWIG_0(swigCPtr, this, n); 748 return (cPtr == 0) ? null : new Parameter(cPtr, false); 749 } 750 751 752/** 753 * Returns the nth {@link LocalParameter} object in the list of local parameters in 754 * this {@link KineticLaw} instance. 755 <p> 756 * @param n the index of the {@link LocalParameter} object sought. 757 <p> 758 * @return the nth {@link LocalParameter} of this {@link KineticLaw}. 759 */ public 760 LocalParameter getLocalParameter(long n) { 761 long cPtr = libsbmlJNI.KineticLaw_getLocalParameter__SWIG_0(swigCPtr, this, n); 762 return (cPtr == 0) ? null : new LocalParameter(cPtr, false); 763 } 764 765 766/** 767 * Returns a local parameter based on its identifier. 768 <p> 769 * @param sid the identifier of the {@link Parameter} being sought. 770 <p> 771 * @return the {@link Parameter} object in this {@link KineticLaw} instace having the 772 * given 'id', or <code>null</code> if no such {@link Parameter} exists. 773 */ public 774 Parameter getParameter(String sid) { 775 long cPtr = libsbmlJNI.KineticLaw_getParameter__SWIG_2(swigCPtr, this, sid); 776 return (cPtr == 0) ? null : new Parameter(cPtr, false); 777 } 778 779 780/** 781 * Returns a local parameter based on its identifier. 782 <p> 783 * @param sid the identifier of the {@link LocalParameter} being sought. 784 <p> 785 * @return the {@link LocalParameter} object in this {@link KineticLaw} instace having the 786 * given 'id', or <code>null</code> if no such {@link LocalParameter} exists. 787 */ public 788 LocalParameter getLocalParameter(String sid) { 789 long cPtr = libsbmlJNI.KineticLaw_getLocalParameter__SWIG_2(swigCPtr, this, sid); 790 return (cPtr == 0) ? null : new LocalParameter(cPtr, false); 791 } 792 793 794/** 795 * Returns the number of local parameters in this {@link KineticLaw} instance. 796 <p> 797 * @return the number of Parameters in this {@link KineticLaw}. 798 */ public 799 long getNumParameters() { 800 return libsbmlJNI.KineticLaw_getNumParameters(swigCPtr, this); 801 } 802 803 804/** 805 * Returns the number of local parameters in this {@link KineticLaw} instance. 806 <p> 807 * @return the number of LocalParameters in this {@link KineticLaw}. 808 */ public 809 long getNumLocalParameters() { 810 return libsbmlJNI.KineticLaw_getNumLocalParameters(swigCPtr, this); 811 } 812 813 814/** 815 * Calculates and returns a {@link UnitDefinition} that expresses the units of 816 * measurement assumed for the 'math' expression of this {@link KineticLaw}. 817 <p> 818 * <p> 819 * The units are calculated based on the mathematical expression in the 820 * {@link KineticLaw} and the model quantities referenced by <code><ci></code> 821 * elements used within that expression. The 822 * {@link KineticLaw#getDerivedUnitDefinition()} 823 * method returns the calculated units. 824 <p> 825 * <p> 826 * @note The functionality that facilitates unit analysis depends on the 827 * model as a whole. Thus, in cases where the object has not been added to 828 * a model or the model itself is incomplete, unit analysis is not possible 829 * and this method will return <code>null.</code> 830 <p> 831 * <p> 832 * @warning <span class='warning'>Note that it is possible the 'math' 833 * expression in the {@link KineticLaw} contains pure numbers or parameters with 834 * undeclared units. In those cases, it is not possible to calculate the 835 * units of the overall expression without making assumptions. LibSBML does 836 * not make assumptions about the units, and 837 * {@link KineticLaw#getDerivedUnitDefinition()} returns the units as far as it is 838 * able to determine them. For example, in an expression <em>X + Y</em>, if 839 * <em>X</em> has unambiguously-defined units and <em>Y</em> does not, it 840 * will return the units of <em>X</em>. <strong>It is important that callers 841 * also invoke the method</strong> 842 * {@link KineticLaw#containsUndeclaredUnits()}<strong>to determine whether this 843 * situation holds</strong>. Callers may wish to take suitable actions in 844 * those scenarios.</span> 845 <p> 846 * @return a {@link UnitDefinition} that expresses the units of the math 847 * expression of this {@link KineticLaw}, or <code>null</code> if one cannot be constructed. 848 <p> 849 * @see #containsUndeclaredUnits() 850 */ public 851 UnitDefinition getDerivedUnitDefinition() { 852 long cPtr = libsbmlJNI.KineticLaw_getDerivedUnitDefinition__SWIG_0(swigCPtr, this); 853 return (cPtr == 0) ? null : new UnitDefinition(cPtr, false); 854 } 855 856 857/** 858 * Predicate returning <code>true</code> if the math expression of this {@link KineticLaw} 859 * contains parameters/numbers with undeclared units. 860 <p> 861 * @return <code>true</code> if the math expression of this {@link KineticLaw} 862 * includes parameters/numbers 863 * with undeclared units, <code>false</code> otherwise. 864 <p> 865 * @note A return value of <code>true</code> indicates that the {@link UnitDefinition} 866 * returned by 867 * {@link KineticLaw#getDerivedUnitDefinition()} 868 * may not accurately represent the units of the expression. 869 <p> 870 * @see #getDerivedUnitDefinition() 871 */ public 872 boolean containsUndeclaredUnits() { 873 return libsbmlJNI.KineticLaw_containsUndeclaredUnits__SWIG_0(swigCPtr, this); 874 } 875 876 877/** 878 * Removes the nth {@link Parameter} object in the list of local parameters 879 * in this {@link KineticLaw} instance and returns a pointer to it. 880 <p> 881 * The caller owns the returned object and is responsible for deleting it. 882 <p> 883 * @param n the index of the {@link Parameter} object to remove. 884 <p> 885 * @return the {@link Parameter} object removed. As mentioned above, 886 * the caller owns the returned item. <code>null</code> is returned if the given index 887 * is out of range. 888 */ public 889 Parameter removeParameter(long n) { 890 long cPtr = libsbmlJNI.KineticLaw_removeParameter__SWIG_0(swigCPtr, this, n); 891 return (cPtr == 0) ? null : new Parameter(cPtr, true); 892 } 893 894 895/** 896 * Removes the nth {@link LocalParameter} object in the list of local parameters 897 * in this {@link KineticLaw} instance and returns a pointer to it. 898 <p> 899 * The caller owns the returned object and is responsible for deleting it. 900 <p> 901 * @param n the index of the {@link LocalParameter} object to remove. 902 <p> 903 * @return the {@link LocalParameter} object removed. As mentioned above, 904 * the caller owns the returned item. <code>null</code> is returned if the given index 905 * is out of range. 906 */ public 907 LocalParameter removeLocalParameter(long n) { 908 long cPtr = libsbmlJNI.KineticLaw_removeLocalParameter__SWIG_0(swigCPtr, this, n); 909 return (cPtr == 0) ? null : new LocalParameter(cPtr, true); 910 } 911 912 913/** 914 * Removes a {@link Parameter} object with the given identifier in the list of 915 * local parameters in this {@link KineticLaw} instance and returns a pointer to it. 916 <p> 917 * The caller owns the returned object and is responsible for deleting it. 918 <p> 919 * @param sid the identifier of the {@link Parameter} to remove. 920 <p> 921 * @return the {@link Parameter} object removed. As mentioned above, the 922 * caller owns the returned object. <code>null</code> is returned if no {@link Parameter} 923 * object with the identifier exists in this {@link KineticLaw} instance. 924 */ public 925 Parameter removeParameter(String sid) { 926 long cPtr = libsbmlJNI.KineticLaw_removeParameter__SWIG_1(swigCPtr, this, sid); 927 return (cPtr == 0) ? null : new Parameter(cPtr, true); 928 } 929 930 931/** 932 * Removes a {@link LocalParameter} object with the given identifier in the list of 933 * local parameters in this {@link KineticLaw} instance and returns a pointer to it. 934 <p> 935 * The caller owns the returned object and is responsible for deleting it. 936 <p> 937 * @param sid the identifier of the {@link LocalParameter} to remove. 938 <p> 939 * @return the {@link LocalParameter} object removed. As mentioned above, the 940 * caller owns the returned object. <code>null</code> is returned if no {@link LocalParameter} 941 * object with the identifier exists in this {@link KineticLaw} instance. 942 */ public 943 LocalParameter removeLocalParameter(String sid) { 944 long cPtr = libsbmlJNI.KineticLaw_removeLocalParameter__SWIG_1(swigCPtr, this, sid); 945 return (cPtr == 0) ? null : new LocalParameter(cPtr, true); 946 } 947 948 public void connectToChild() { 949 libsbmlJNI.KineticLaw_connectToChild(swigCPtr, this); 950 } 951 952 953/** * @internal */ public 954 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 955 libsbmlJNI.KineticLaw_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 956 } 957 958 959/** 960 * Returns the libSBML type code for this SBML object. 961 <p> 962 * <p> 963 * LibSBML attaches an identifying code to every kind of SBML object. These 964 * are integer constants known as <em>SBML type codes</em>. The names of all 965 * the codes begin with the characters <code>SBML_</code>. 966 * In the Java language interface for libSBML, the 967 * type codes are defined as static integer constants in the interface class 968 * {@link libsbmlConstants}. Note that different Level 3 969 * package plug-ins may use overlapping type codes; to identify the package 970 * to which a given object belongs, call the <code>getPackageName()</code> 971 * method on the object. 972 <p> 973 * @return the SBML type code for this object: 974 * {@link libsbmlConstants#SBML_KINETIC_LAW SBML_KINETIC_LAW} (default). 975 <p> 976 * <p> 977 * @warning <span class='warning'>The specific integer values of the possible 978 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 979 * packages, To fully identify the correct code, <strong>it is necessary to 980 * invoke both getTypeCode() and getPackageName()</strong>.</span> 981 <p> 982 * @see #getElementName() 983 * @see #getPackageName() 984 */ public 985 int getTypeCode() { 986 return libsbmlJNI.KineticLaw_getTypeCode(swigCPtr, this); 987 } 988 989 990/** 991 * Returns the XML element name of this object, which for {@link Species}, is 992 * always <code>'kineticLaw'.</code> 993 <p> 994 * @return the name of this element, i.e., <code>'kineticLaw'.</code> 995 */ public 996 String getElementName() { 997 return libsbmlJNI.KineticLaw_getElementName(swigCPtr, this); 998 } 999 1000 1001/** 1002 * Predicate returning <code>true</code> if all the required attributes for this 1003 * {@link KineticLaw} object have been set. 1004 <p> 1005 * The required attributes for a {@link KineticLaw} object are: 1006 * <ul> 1007 * <li> 'formula' (SBML Level 1 only) 1008 * 1009 * </ul> <p> 1010 * @return <code>true</code> if the required attributes have been set, <code>false</code> 1011 * otherwise. 1012 */ public 1013 boolean hasRequiredAttributes() { 1014 return libsbmlJNI.KineticLaw_hasRequiredAttributes(swigCPtr, this); 1015 } 1016 1017 1018/** 1019 * Predicate returning <code>true</code> if all the required elements for this 1020 * {@link KineticLaw} object have been set. 1021 <p> 1022 * @note The required elements for a {@link KineticLaw} object are: 1023 * <ul> 1024 * <li> 'math' inSBML Level 2 and Level 3 Version 1. 1025 * (In SBML Level 3 Version 2+, it is no longer required.) 1026 * 1027 * </ul> <p> 1028 * @return a boolean value indicating whether all the required 1029 * elements for this object have been defined. 1030 */ public 1031 boolean hasRequiredElements() { 1032 return libsbmlJNI.KineticLaw_hasRequiredElements(swigCPtr, this); 1033 } 1034 1035 1036/** 1037 * Finds this {@link KineticLaw}'s {@link Reaction} parent and calls unsetKineticLaw() on 1038 * it, indirectly deleting itself. 1039 <p> 1040 * Overridden from the {@link SBase} function since the parent is not a {@link ListOf}. 1041 <p> 1042 * <p> 1043 * @return integer value indicating success/failure of the 1044 * function. The possible values 1045 * returned by this function are: 1046 * <ul> 1047 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1048 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1049 * </ul> 1050 */ public 1051 int removeFromParentAndDelete() { 1052 return libsbmlJNI.KineticLaw_removeFromParentAndDelete(swigCPtr, this); 1053 } 1054 1055 1056/** 1057 * <p> 1058 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another 1059 * value. 1060 <p> 1061 * <p> 1062 * In SBML, object identifiers are of a data type called <code>SId</code>. 1063 * In SBML Level 3, an explicit data type called <code>SIdRef</code> was 1064 * introduced for attribute values that refer to <code>SId</code> values; in 1065 * previous Levels of SBML, this data type did not exist and attributes were 1066 * simply described to as 'referring to an identifier', but the effective 1067 * data type was the same as <code>SIdRef</code> in Level 3. These and 1068 * other methods of libSBML refer to the type <code>SIdRef</code> for all 1069 * Levels of SBML, even if the corresponding SBML specification did not 1070 * explicitly name the data type. 1071 <p> 1072 * This method works by looking at all attributes and (if appropriate) 1073 * mathematical formulas in MathML content, comparing the referenced 1074 * identifiers to the value of <code>oldid</code>. If any matches are found, the 1075 * matching values are replaced with <code>newid</code>. The method does <em>not</em> 1076 * descend into child elements. 1077 <p> 1078 * @param oldid the old identifier. 1079 * @param newid the new identifier. 1080 */ public 1081 void renameSIdRefs(String oldid, String newid) { 1082 libsbmlJNI.KineticLaw_renameSIdRefs(swigCPtr, this, oldid, newid); 1083 } 1084 1085 1086/** 1087 * <p> 1088 * Replaces all uses of a given <code>UnitSIdRef</code> type attribute value with 1089 * another value. 1090 <p> 1091 * <p> 1092 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>. In 1093 * SBML Level 3, an explicit data type called <code>UnitSIdRef</code> was 1094 * introduced for attribute values that refer to <code>UnitSId</code> values; in 1095 * previous Levels of SBML, this data type did not exist and attributes were 1096 * simply described to as 'referring to a unit identifier', but the effective 1097 * data type was the same as <code>UnitSIdRef</code> in Level 3. These and 1098 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all 1099 * Levels of SBML, even if the corresponding SBML specification did not 1100 * explicitly name the data type. 1101 <p> 1102 * This method works by looking at all unit identifier attribute values 1103 * (including, if appropriate, inside mathematical formulas), comparing the 1104 * referenced unit identifiers to the value of <code>oldid</code>. If any matches 1105 * are found, the matching values are replaced with <code>newid</code>. The method 1106 * does <em>not</em> descend into child elements. 1107 <p> 1108 * @param oldid the old identifier. 1109 * @param newid the new identifier. 1110 */ public 1111 void renameUnitSIdRefs(String oldid, String newid) { 1112 libsbmlJNI.KineticLaw_renameUnitSIdRefs(swigCPtr, this, oldid, newid); 1113 } 1114 1115 1116/** * @internal */ public 1117 void replaceSIDWithFunction(String id, ASTNode function) { 1118 libsbmlJNI.KineticLaw_replaceSIDWithFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function); 1119 } 1120 1121 1122/** * @internal */ public 1123 void divideAssignmentsToSIdByFunction(String id, ASTNode function) { 1124 libsbmlJNI.KineticLaw_divideAssignmentsToSIdByFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function); 1125 } 1126 1127 1128/** * @internal */ public 1129 void multiplyAssignmentsToSIdByFunction(String id, ASTNode function) { 1130 libsbmlJNI.KineticLaw_multiplyAssignmentsToSIdByFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function); 1131 } 1132 1133}