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 * An SBML parameter: a named symbol with a value. 013 <p> 014 * A {@link Parameter} is used in SBML to define a symbol associated with a value; 015 * this symbol can then be used in mathematical formulas in a model. By 016 * default, parameters have constant value for the duration of a 017 * simulation, and for this reason are called <em>parameters</em> instead of 018 * <em>variables</em> in SBML, although it is crucial to understand that <em>SBML 019 * parameters represent both concepts</em>. Whether a given SBML 020 * parameter is intended to be constant or variable is indicated by the 021 * value of its 'constant' attribute. 022 <p> 023 * SBML's {@link Parameter} has a required attribute, 'id', that gives the 024 * parameter a unique identifier by which other parts of an SBML model 025 * definition can refer to it. A parameter can also have an optional 026 * 'name' attribute of type <code>string.</code> Identifiers and names must be used 027 * according to the guidelines described in the SBML specifications. 028 <p> 029 * The optional attribute 'value' determines the value (of type <code>double</code>) 030 * assigned to the parameter. A missing value for 'value' implies that 031 * the value either is unknown, or to be obtained from an external source, 032 * or determined by an initial assignment. The unit of measurement 033 * associated with the value of the parameter can be specified using the 034 * optional attribute 'units'. Here we only mention briefly some notable 035 * points about the possible unit choices, but readers are urged to consult 036 * the SBML specification documents for more information: 037 * <ul> 038 <p> 039 * <li> In SBML Level 3, there are no constraints on the units that 040 * can be assigned to parameters in a model; there are also no units to 041 * inherit from the enclosing {@link Model} object (unlike the case for, e.g., 042 * {@link Species} and {@link Compartment}). 043 <p> 044 * <li> In SBML Level 2, the value assigned to the parameter's 'units' 045 * attribute must be chosen from one of the following possibilities: one of 046 * the base unit identifiers defined in SBML; one of the built-in unit 047 * identifiers <code>'substance'</code>, <code>'time'</code>, <code>'volume'</code>, <code>'area'</code> or 048 * <code>'length'</code>; or the identifier of a new unit defined in the list of unit 049 * definitions in the enclosing {@link Model} structure. There are no constraints 050 * on the units that can be chosen from these sets. There are no default 051 * units for parameters. 052 * </ul> 053 <p> 054 * The {@link Parameter} structure has another boolean attribute named 'constant' 055 * that is used to indicate whether the parameter's value can vary during a 056 * simulation. (In SBML Level 3, the attribute is mandatory and must 057 * be given a value; in SBML Levels below Level 3, the attribute is 058 * optional.) A value of <code>true</code> indicates the parameter's value cannot be 059 * changed by any construct except {@link InitialAssignment}. Conversely, if the 060 * value of 'constant' is <code>false</code>, other constructs in SBML, such as rules 061 * and events, can change the value of the parameter. 062 <p> 063 * SBML Level 3 uses a separate object class, {@link LocalParameter}, for 064 * parameters that are local to a {@link Reaction}'s {@link KineticLaw}. In Levels prior 065 * to SBML Level 3, the {@link Parameter} class is used both for definitions 066 * of global parameters, as well as reaction-local parameters stored in a 067 * list within {@link KineticLaw} objects. {@link Parameter} objects that are local to a 068 * reaction (that is, those defined within the {@link KineticLaw} structure of a 069 * {@link Reaction}) cannot be changed by rules and therefore are <em>implicitly 070 * always constant</em>; consequently, in SBML Level 2, parameter 071 * definitions within {@link Reaction} structures should <em>not</em> have their 072 * 'constant' attribute set to <code>false.</code> 073 <p> 074 * What if a global parameter has its 'constant' attribute set to <code>false</code>, 075 * but the model does not contain any rules, events or other constructs 076 * that ever change its value over time? Although the model may be 077 * suspect, this situation is not strictly an error. A value of <code>false</code> 078 * for 'constant' only indicates that a parameter <em>can</em> change value, not 079 * that it <em>must</em>. 080 <p> 081 * As with all other major SBML components, {@link Parameter} is derived from 082 * {@link SBase}, and the methods defined on {@link SBase} are available on {@link Parameter}. 083 <p> 084 * @note The use of the term <em>parameter</em> in SBML sometimes leads to 085 * confusion among readers who have a particular notion of what something 086 * called 'parameter' should be. It has been the source of heated debate, 087 * but despite this, no one has yet found an adequate replacement term that 088 * does not have different connotations to different people and hence leads 089 * to confusion among <em>some</em> subset of users. Perhaps it would have been 090 * better to have two constructs, one called <em>constants</em> and the other 091 * called <em>variables</em>. The current approach in SBML is simply more 092 * parsimonious, using a single {@link Parameter} construct with the boolean flag 093 * 'constant' indicating which flavor it is. In any case, readers are 094 * implored to look past their particular definition of a <em>parameter</em> and 095 * simply view SBML's {@link Parameter} as a single mechanism for defining both 096 * constants and (additional) variables in a model. (We write 097 * <em>additional</em> because the species in a model are usually considered to be 098 * the central variables.) After all, software tools are not required to 099 * expose to users the actual names of particular SBML constructs, and 100 * thus tools can present to their users whatever terms their designers 101 * feel best matches their target audience. 102 <p> 103 * @see ListOfParameters 104 */ 105 106public class Parameter extends SBase { 107 private long swigCPtr; 108 109 protected Parameter(long cPtr, boolean cMemoryOwn) 110 { 111 super(libsbmlJNI.Parameter_SWIGUpcast(cPtr), cMemoryOwn); 112 swigCPtr = cPtr; 113 } 114 115 protected static long getCPtr(Parameter obj) 116 { 117 return (obj == null) ? 0 : obj.swigCPtr; 118 } 119 120 protected static long getCPtrAndDisown (Parameter obj) 121 { 122 long ptr = 0; 123 124 if (obj != null) 125 { 126 ptr = obj.swigCPtr; 127 obj.swigCMemOwn = false; 128 } 129 130 return ptr; 131 } 132 133 protected void finalize() { 134 delete(); 135 } 136 137 public synchronized void delete() { 138 if (swigCPtr != 0) { 139 if (swigCMemOwn) { 140 swigCMemOwn = false; 141 libsbmlJNI.delete_Parameter(swigCPtr); 142 } 143 swigCPtr = 0; 144 } 145 super.delete(); 146 } 147 148 149/** 150 * Creates a new {@link Parameter} using the given SBML <code>level</code> and <code>version</code> 151 * values. 152 <p> 153 * @param level a long integer, the SBML Level to assign to this {@link Parameter} 154 <p> 155 * @param version a long integer, the SBML Version to assign to this 156 * {@link Parameter} 157 <p> 158 * <p> 159 * @throws SBMLConstructorException 160 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid 161 * or if this object is incompatible with the given level and version. 162 <p> 163 * <p> 164 * @note Attempting to add an object to an {@link SBMLDocument} having a different 165 * combination of SBML Level, Version and XML namespaces than the object 166 * itself will result in an error at the time a caller attempts to make the 167 * addition. A parent object must have compatible Level, Version and XML 168 * namespaces. (Strictly speaking, a parent may also have more XML 169 * namespaces than a child, but the reverse is not permitted.) The 170 * restriction is necessary to ensure that an SBML model has a consistent 171 * overall structure. This requires callers to manage their objects 172 * carefully, but the benefit is increased flexibility in how models can be 173 * created by permitting callers to create objects bottom-up if desired. In 174 * situations where objects are not yet attached to parents (e.g., 175 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 176 * libSBML determine such things as whether it is valid to assign a 177 * particular value to an attribute. 178 */ public 179 Parameter(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 180 this(libsbmlJNI.new_Parameter__SWIG_0(level, version), true); 181 } 182 183 184/** 185 * Creates a new {@link Parameter} using the given {@link SBMLNamespaces} object 186 * <code>sbmlns</code>. 187 <p> 188 * <p> 189 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 190 * information. It is used to communicate the SBML Level, Version, and (in 191 * Level 3) packages used in addition to SBML Level 3 Core. A 192 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 193 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 194 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 195 <p> 196 * It is worth emphasizing that although this constructor does not take 197 * an identifier argument, in SBML Level 2 and beyond, the 'id' 198 * (identifier) attribute of a {@link Parameter} is required to have a value. 199 * Thus, callers are cautioned to assign a value after calling this 200 * constructor if no identifier is provided as an argument. Setting the 201 * identifier can be accomplished using the method 202 * setId(String id). 203 <p> 204 * @param sbmlns an {@link SBMLNamespaces} object. 205 <p> 206 * <p> 207 * @throws SBMLConstructorException 208 * Thrown if the given <code>sbmlns</code> is inconsistent or incompatible 209 * with this 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. 226 */ public 227 Parameter(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 228 this(libsbmlJNI.new_Parameter__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 229 } 230 231 232/** 233 * Copy constructor; creates a copy of a {@link Parameter}. 234 <p> 235 * @param orig the {@link Parameter} instance to copy. 236 */ public 237 Parameter(Parameter orig) throws org.sbml.libsbml.SBMLConstructorException { 238 this(libsbmlJNI.new_Parameter__SWIG_2(Parameter.getCPtr(orig), orig), true); 239 } 240 241 242/** 243 * Creates and returns a deep copy of this {@link Parameter} object. 244 <p> 245 * @return the (deep) copy of this {@link Parameter} object. 246 */ public 247 Parameter cloneObject() { 248 long cPtr = libsbmlJNI.Parameter_cloneObject(swigCPtr, this); 249 return (cPtr == 0) ? null : new Parameter(cPtr, true); 250 } 251 252 253/** 254 * Initializes the fields of this {@link Parameter} object to 'typical' defaults 255 * values. 256 <p> 257 * The SBML {@link Parameter} component has slightly different aspects and 258 * default attribute values in different SBML Levels and Versions. Many 259 * SBML object classes defined by libSBML have an initDefaults() method 260 * to set the values to certain common defaults, based mostly on what 261 * they are in SBML Level 2. In the case of {@link Parameter}, this method 262 * only sets the value of the 'constant' attribute to <code>true.</code> 263 <p> 264 * @see #getConstant() 265 * @see #isSetConstant() 266 * @see #setConstant(boolean) 267 */ public 268 void initDefaults() { 269 libsbmlJNI.Parameter_initDefaults(swigCPtr, this); 270 } 271 272 273/** 274 * Returns the value of the 'id' attribute of this {@link Parameter}. 275 <p> 276 * @return the id of this {@link Parameter}. 277 */ public 278 String getId() { 279 return libsbmlJNI.Parameter_getId(swigCPtr, this); 280 } 281 282 283/** 284 * Returns the value of the 'name' attribute of this {@link Parameter}. 285 <p> 286 * @return the name of this {@link Parameter}. 287 */ public 288 String getName() { 289 return libsbmlJNI.Parameter_getName(swigCPtr, this); 290 } 291 292 293/** 294 * Gets the numerical value of this {@link Parameter}. 295 <p> 296 * @return the value of the 'value' attribute of this {@link Parameter}, as a 297 * number of type <code>double.</code> 298 <p> 299 * @note <b>It is crucial</b> that callers not blindly call 300 * {@link Parameter#getValue()} without first using {@link Parameter#isSetValue()} to 301 * determine whether a value has ever been set. Otherwise, the value 302 * return by {@link Parameter#getValue()} may not actually represent a value 303 * assigned to the parameter. The reason is simply that the data type 304 * <code>double</code> in a program always has <em>some</em> value. A separate test is 305 * needed to determine whether the value is a true model value, or 306 * uninitialized data in a computer's memory location. 307 <p> 308 * @see #isSetValue() 309 * @see #setValue(double value) 310 * @see #getUnits() 311 */ public 312 double getValue() { 313 return libsbmlJNI.Parameter_getValue(swigCPtr, this); 314 } 315 316 317/** 318 * Gets the units defined for this {@link Parameter}. 319 <p> 320 * The value of an SBML parameter's 'units' attribute establishes the 321 * unit of measurement associated with the parameter's value. 322 <p> 323 * @return the value of the 'units' attribute of this {@link Parameter}, as a 324 * string. An empty string indicates that no units have been assigned. 325 <p> 326 * <p> 327 * @note There is an important distinction to be made between <em>no units 328 * assigned</em>, and assuming a value without units has any specific unit 329 * such as <code>dimensionless</code>. In SBML, default units are never 330 * attributed to numbers, and numbers without units are not automatically 331 * assumed to have the unit <code>dimensionless</code>. Please consult the 332 * relevant SBML specification document for a more in-depth explanation of 333 * this topic and the SBML unit system. 334 <p> 335 * @see #isSetUnits() 336 * @see #setUnits(String) 337 * @see #getValue() 338 */ public 339 String getUnits() { 340 return libsbmlJNI.Parameter_getUnits(swigCPtr, this); 341 } 342 343 344/** 345 * Gets the value of the 'constant' attribute of this {@link Parameter} instance. 346 <p> 347 * @return <code>true</code> if this {@link Parameter} is declared as being constant, 348 * <code>false</code> otherwise. 349 <p> 350 * <p> 351 * @note Readers who view the documentation for {@link LocalParameter} may be 352 * confused about the presence of this method. LibSBML derives 353 * {@link LocalParameter} from {@link Parameter}; however, this does not precisely match 354 * the object hierarchy defined by SBML Level 3, where 355 * {@link LocalParameter} is derived directly from {@link SBase} and not {@link Parameter}. We 356 * believe this arrangement makes it easier for libSBML users to program 357 * applications that work with both SBML Level 2 and SBML 358 * Level 3, but programmers should also keep in mind this difference 359 * exists. A side-effect of libSBML's scheme is that certain methods on 360 * {@link LocalParameter} that are inherited from {@link Parameter} do not actually have 361 * relevance to {@link LocalParameter} objects. An example of this is the 362 * methods pertaining to {@link Parameter}'s attribute 'constant' (i.e., 363 * isSetConstant(), setConstant(), and getConstant()). 364 <p> 365 * @see #isSetConstant() 366 * @see #setConstant(boolean) 367 */ public 368 boolean getConstant() { 369 return libsbmlJNI.Parameter_getConstant(swigCPtr, this); 370 } 371 372 373/** 374 * Predicate returning <code>true</code> if this 375 * {@link Parameter}'s 'id' attribute is set. 376 <p> 377 * @return <code>true</code> if the 'id' attribute of this {@link Parameter} is 378 * set, <code>false</code> otherwise. 379 */ public 380 boolean isSetId() { 381 return libsbmlJNI.Parameter_isSetId(swigCPtr, this); 382 } 383 384 385/** 386 * Predicate returning <code>true</code> if this 387 * {@link Parameter}'s 'name' attribute is set. 388 <p> 389 * @return <code>true</code> if the 'name' attribute of this {@link Parameter} is 390 * set, <code>false</code> otherwise. 391 */ public 392 boolean isSetName() { 393 return libsbmlJNI.Parameter_isSetName(swigCPtr, this); 394 } 395 396 397/** 398 * Predicate returning <code>true</code> if the 399 * 'value' attribute of this {@link Parameter} is set. 400 <p> 401 * In SBML definitions after SBML Level 1 Version 1, 402 * parameter values are optional and have no defaults. If a model read 403 * from a file does not contain a setting for the 'value' attribute of a 404 * parameter, its value is considered unset; it does not default to any 405 * particular value. Similarly, when a {@link Parameter} object is created in 406 * libSBML, it has no value until given a value. The 407 * {@link Parameter#isSetValue()} method allows calling applications to 408 * determine whether a given parameter's value has ever been set. 409 <p> 410 * In SBML Level 1 Version 1, parameters are required to have 411 * values and therefore, the value of a {@link Parameter} <b>should always be 412 * set</b>. In Level 1 Version 2 and beyond, the value is 413 * optional and as such, the 'value' attribute may or may not be set. 414 <p> 415 * @return <code>true</code> if the value of this {@link Parameter} is set, 416 * <code>false</code> otherwise. 417 <p> 418 * @see #getValue() 419 * @see #setValue(double value) 420 */ public 421 boolean isSetValue() { 422 return libsbmlJNI.Parameter_isSetValue(swigCPtr, this); 423 } 424 425 426/** 427 * Predicate returning <code>true</code> if the 428 * 'units' attribute of this {@link Parameter} is set. 429 <p> 430 * @return <code>true</code> if the 'units' attribute of this {@link Parameter} is 431 * set, <code>false</code> otherwise. 432 <p> 433 * <p> 434 * @note There is an important distinction to be made between <em>no units 435 * assigned</em>, and assuming a value without units has any specific unit 436 * such as <code>dimensionless</code>. In SBML, default units are never 437 * attributed to numbers, and numbers without units are not automatically 438 * assumed to have the unit <code>dimensionless</code>. Please consult the 439 * relevant SBML specification document for a more in-depth explanation of 440 * this topic and the SBML unit system. 441 */ public 442 boolean isSetUnits() { 443 return libsbmlJNI.Parameter_isSetUnits(swigCPtr, this); 444 } 445 446 447/** 448 * Predicate returning <code>true</code> if the 449 * 'constant' attribute of this {@link Parameter} is set. 450 <p> 451 * @return <code>true</code> if the 'constant' attribute of this {@link Parameter} is 452 * set, <code>false</code> otherwise. 453 <p> 454 * <p> 455 * @note Readers who view the documentation for {@link LocalParameter} may be 456 * confused about the presence of this method. LibSBML derives 457 * {@link LocalParameter} from {@link Parameter}; however, this does not precisely match 458 * the object hierarchy defined by SBML Level 3, where 459 * {@link LocalParameter} is derived directly from {@link SBase} and not {@link Parameter}. We 460 * believe this arrangement makes it easier for libSBML users to program 461 * applications that work with both SBML Level 2 and SBML 462 * Level 3, but programmers should also keep in mind this difference 463 * exists. A side-effect of libSBML's scheme is that certain methods on 464 * {@link LocalParameter} that are inherited from {@link Parameter} do not actually have 465 * relevance to {@link LocalParameter} objects. An example of this is the 466 * methods pertaining to {@link Parameter}'s attribute 'constant' (i.e., 467 * isSetConstant(), setConstant(), and getConstant()). 468 <p> 469 * @see #getConstant() 470 * @see #setConstant(boolean) 471 */ public 472 boolean isSetConstant() { 473 return libsbmlJNI.Parameter_isSetConstant(swigCPtr, this); 474 } 475 476 477/** 478 * Sets the value of the 'id' attribute of this {@link Parameter}. 479 <p> 480 * The string <code>sid</code> is copied. 481 <p> 482 * <p> 483 * SBML has strict requirements for the syntax of identifiers, that is, the 484 * values of the 'id' attribute present on most types of SBML objects. 485 * The following is a summary of the definition of the SBML identifier type 486 * <code>SId</code>, which defines the permitted syntax of identifiers. We 487 * express the syntax using an extended form of BNF notation: 488 * <pre style='margin-left: 2em; border: none; font-weight: bold; font-size: 13px; color: black'> 489 * letter .= 'a'..'z','A'..'Z' 490 * digit .= '0'..'9' 491 * idChar .= letter | digit | '_' 492 * SId .= ( letter | '_' ) idChar*</pre> 493 * The characters <code>(</code> and <code>)</code> are used for grouping, the 494 * character <code>*</code> 'zero or more times', and the character 495 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers is 496 * determined by an exact character sequence match; i.e., comparisons must be 497 * performed in a case-sensitive manner. In addition, there are a few 498 * conditions for the uniqueness of identifiers in an SBML model. Please 499 * consult the SBML specifications for the exact details of the uniqueness 500 * requirements. 501 <p> 502 * @param sid the string to use as the identifier of this {@link Parameter} 503 <p> 504 * <p> 505 * @return integer value indicating success/failure of the 506 * function. The possible values 507 * returned by this function are: 508 * <ul> 509 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 510 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 511 * </ul> 512 */ public 513 int setId(String sid) { 514 return libsbmlJNI.Parameter_setId(swigCPtr, this, sid); 515 } 516 517 518/** 519 * Sets the value of the 'name' attribute of this {@link Parameter}. 520 <p> 521 * The string in <code>name</code> is copied. 522 <p> 523 * @param name the new name for the {@link Parameter} 524 <p> 525 * <p> 526 * @return integer value indicating success/failure of the 527 * function. The possible values 528 * returned by this function are: 529 * <ul> 530 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 531 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 532 * </ul> 533 */ public 534 int setName(String name) { 535 return libsbmlJNI.Parameter_setName(swigCPtr, this, name); 536 } 537 538 539/** 540 * Sets the 'value' attribute of this {@link Parameter} to the given <code>double</code> 541 * value and marks the attribute as set. 542 <p> 543 * @param value a <code>double</code>, the value to assign 544 <p> 545 * <p> 546 * @return integer value indicating success/failure of the 547 * function. The possible values 548 * returned by this function are: 549 * <ul> 550 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 551 * </ul> 552 */ public 553 int setValue(double value) { 554 return libsbmlJNI.Parameter_setValue(swigCPtr, this, value); 555 } 556 557 558/** 559 * Sets the 'units' attribute of this {@link Parameter} to a copy of the given 560 * units identifier <code>units</code>. 561 <p> 562 * @param units a string, the identifier of the units to assign to this 563 * {@link Parameter} instance 564 <p> 565 * <p> 566 * @return integer value indicating success/failure of the 567 * function. The possible values 568 * returned by this function are: 569 * <ul> 570 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 571 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 572 * </ul> 573 */ public 574 int setUnits(String units) { 575 return libsbmlJNI.Parameter_setUnits(swigCPtr, this, units); 576 } 577 578 579/** 580 * Sets the 'constant' attribute of this {@link Parameter} to the given boolean 581 * <code>flag</code>. 582 <p> 583 * @param flag a boolean, the value for the 'constant' attribute of this 584 * {@link Parameter} instance 585 <p> 586 * <p> 587 * @return integer value indicating success/failure of the 588 * function. The possible values 589 * returned by this function are: 590 * <ul> 591 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 592 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 593 * 594 * </ul> <p> 595 * <p> 596 * @note Readers who view the documentation for {@link LocalParameter} may be 597 * confused about the presence of this method. LibSBML derives 598 * {@link LocalParameter} from {@link Parameter}; however, this does not precisely match 599 * the object hierarchy defined by SBML Level 3, where 600 * {@link LocalParameter} is derived directly from {@link SBase} and not {@link Parameter}. We 601 * believe this arrangement makes it easier for libSBML users to program 602 * applications that work with both SBML Level 2 and SBML 603 * Level 3, but programmers should also keep in mind this difference 604 * exists. A side-effect of libSBML's scheme is that certain methods on 605 * {@link LocalParameter} that are inherited from {@link Parameter} do not actually have 606 * relevance to {@link LocalParameter} objects. An example of this is the 607 * methods pertaining to {@link Parameter}'s attribute 'constant' (i.e., 608 * isSetConstant(), setConstant(), and getConstant()). 609 <p> 610 * @see #getConstant() 611 * @see #isSetConstant() 612 */ public 613 int setConstant(boolean flag) { 614 return libsbmlJNI.Parameter_setConstant(swigCPtr, this, flag); 615 } 616 617 618/** 619 * Unsets the value of the 'name' attribute of this {@link Parameter}. 620 <p> 621 * <p> 622 * @return integer value indicating success/failure of the 623 * function. The possible values 624 * returned by this function are: 625 * <ul> 626 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 627 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 628 * </ul> 629 */ public 630 int unsetName() { 631 return libsbmlJNI.Parameter_unsetName(swigCPtr, this); 632 } 633 634 635/** 636 * Unsets the value of the 'constant' attribute of this {@link Parameter} object. 637 <p> 638 * <p> 639 * @return integer value indicating success/failure of the 640 * function. The possible values 641 * returned by this function are: 642 * <ul> 643 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 644 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 645 * 646 * </ul> <p> 647 * @see #isSetConstant() 648 * @see #setConstant(boolean) 649 * @see #getConstant() 650 */ public 651 int unsetConstant() { 652 return libsbmlJNI.Parameter_unsetConstant(swigCPtr, this); 653 } 654 655 656/** 657 * Unsets the 'value' attribute of this {@link Parameter} instance. 658 <p> 659 * <p> 660 * @return integer value indicating success/failure of the 661 * function. The possible values 662 * returned by this function are: 663 * <ul> 664 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 665 * 666 * </ul> <p> 667 * In SBML Level 1 Version 1, parameters are required to have 668 * values and therefore, the value of a {@link Parameter} <b>should always be 669 * set</b>. In SBML Level 1 Version 2 and beyond, the value 670 * is optional and as such, the 'value' attribute may or may not be set. 671 */ public 672 int unsetValue() { 673 return libsbmlJNI.Parameter_unsetValue(swigCPtr, this); 674 } 675 676 677/** 678 * Unsets the 'units' attribute of this {@link Parameter} instance. 679 <p> 680 * <p> 681 * @return integer value indicating success/failure of the 682 * function. The possible values 683 * returned by this function are: 684 * <ul> 685 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 686 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 687 * </ul> 688 */ public 689 int unsetUnits() { 690 return libsbmlJNI.Parameter_unsetUnits(swigCPtr, this); 691 } 692 693 694/** 695 * Constructs and returns a {@link UnitDefinition} that corresponds to the units 696 * of this {@link Parameter}'s value. 697 <p> 698 * Parameters in SBML have an attribute ('units') for declaring the units 699 * of measurement intended for the parameter's value. <b>No defaults are 700 * defined</b> by SBML in the absence of a definition for 'units'. This 701 * method returns a {@link UnitDefinition} object based on the units declared for 702 * this {@link Parameter} using its 'units' attribute, or it returns <code>null</code> if 703 * no units have been declared. 704 <p> 705 * Note that unit declarations for {@link Parameter} objects are specified in 706 * terms of the <em>identifier</em> of a unit (e.g., using setUnits()), but 707 * <em>this</em> method returns a {@link UnitDefinition} object, not a unit 708 * identifier. It does this by constructing an appropriate 709 * {@link UnitDefinition}.For SBML Level 2 models, it will do this even when 710 * the value of the 'units' attribute is one of the special SBML 711 * Level 2 unit identifiers <code>'substance'</code>, <code>'volume'</code>, <code>'area'</code>, 712 * <code>'length'</code> or <code>'time'.</code> Callers may find this useful in conjunction 713 * with the helper methods provided by the {@link UnitDefinition} class for 714 * comparing different {@link UnitDefinition} objects. 715 <p> 716 * @return a {@link UnitDefinition} that expresses the units of this 717 * {@link Parameter}, or <code>null</code> if one cannot be constructed. 718 <p> 719 * @note The libSBML system for unit analysis depends on the model as a 720 * whole. In cases where the {@link Parameter} object has not yet been added to 721 * a model, or the model itself is incomplete, unit analysis is not 722 * possible, and consequently this method will return <code>null.</code> 723 <p> 724 * @see #isSetUnits() 725 */ public 726 UnitDefinition getDerivedUnitDefinition() { 727 long cPtr = libsbmlJNI.Parameter_getDerivedUnitDefinition__SWIG_0(swigCPtr, this); 728 return (cPtr == 0) ? null : new UnitDefinition(cPtr, false); 729 } 730 731 732/** 733 * Returns the libSBML type code for this SBML object. 734 <p> 735 * <p> 736 * LibSBML attaches an identifying code to every kind of SBML object. These 737 * are integer constants known as <em>SBML type codes</em>. The names of all 738 * the codes begin with the characters <code>SBML_</code>. 739 * In the Java language interface for libSBML, the 740 * type codes are defined as static integer constants in the interface class 741 * {@link libsbmlConstants}. Note that different Level 3 742 * package plug-ins may use overlapping type codes; to identify the package 743 * to which a given object belongs, call the <code>getPackageName()</code> 744 * method on the object. 745 <p> 746 * @return the SBML type code for this object: 747 * {@link libsbmlConstants#SBML_PARAMETER SBML_PARAMETER} (default). 748 <p> 749 * <p> 750 * @warning <span class='warning'>The specific integer values of the possible 751 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 752 * packages, To fully identify the correct code, <strong>it is necessary to 753 * invoke both getTypeCode() and getPackageName()</strong>.</span> 754 <p> 755 * @see #getElementName() 756 * @see #getPackageName() 757 */ public 758 int getTypeCode() { 759 return libsbmlJNI.Parameter_getTypeCode(swigCPtr, this); 760 } 761 762 763/** 764 * Returns the XML element name of this object, which for {@link Parameter}, is 765 * always <code>'parameter'.</code> 766 <p> 767 * @return the name of this element, i.e., <code>'parameter'.</code> 768 */ public 769 String getElementName() { 770 return libsbmlJNI.Parameter_getElementName(swigCPtr, this); 771 } 772 773 774/** 775 * Predicate returning <code>true</code> if 776 * all the required attributes for this {@link Parameter} object 777 * have been set. 778 <p> 779 * The required attributes for a {@link Parameter} object are: 780 * <ul> 781 * <li> 'id' (or 'name' in SBML Level 1) 782 * <li> 'value' (required in Level 1, optional otherwise) 783 * 784 * </ul> <p> 785 * @return <code>true</code> if the required attributes have been set, <code>false</code> 786 * otherwise. 787 */ public 788 boolean hasRequiredAttributes() { 789 return libsbmlJNI.Parameter_hasRequiredAttributes(swigCPtr, this); 790 } 791 792 793/** 794 * Renames all the <code>UnitSIdRef</code> attributes on this element. 795 <p> 796 * <p> 797 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>. In 798 * SBML Level 3, an explicit data type called <code>UnitSIdRef</code> was 799 * introduced for attribute values that refer to <code>UnitSId</code> values; in 800 * previous Levels of SBML, this data type did not exist and attributes were 801 * simply described to as 'referring to a unit identifier', but the effective 802 * data type was the same as <code>UnitSIdRef</code> in Level 3. These and 803 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all 804 * Levels of SBML, even if the corresponding SBML specification did not 805 * explicitly name the data type. 806 <p> 807 * This method works by looking at all unit identifier attribute values 808 * (including, if appropriate, inside mathematical formulas), comparing the 809 * unit identifiers to the value of <code>oldid</code>. If any matches are found, 810 * the matching identifiers are replaced with <code>newid</code>. The method does 811 * <em>not</em> descend into child elements. 812 <p> 813 * @param oldid the old identifier 814 * @param newid the new identifier 815 */ public 816 void renameUnitSIdRefs(String oldid, String newid) { 817 libsbmlJNI.Parameter_renameUnitSIdRefs(swigCPtr, this, oldid, newid); 818 } 819 820 821/** * @internal */ public 822 void setCalculatingUnits(boolean calculatingUnits) { 823 libsbmlJNI.Parameter_setCalculatingUnits(swigCPtr, this, calculatingUnits); 824 } 825 826}