001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.12 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * Implementation of SBML's Parameter construct. 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 * @throws SBMLConstructorException 159 * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind 160 * of SBML object, are either invalid or mismatched with respect to the 161 * parent {@link SBMLDocument} object. 162 <p> 163 * <p> 164 * @note Upon the addition of a {@link Parameter} object to an {@link SBMLDocument} 165 * (e.g., using {@link Model#addParameter(Parameter p)}), the SBML Level, SBML Version 166 * and XML namespace of the document <em>override</em> the values used 167 * when creating the {@link Parameter} object via this constructor. This is 168 * necessary to ensure that an SBML document is a consistent structure. 169 * Nevertheless, the ability to supply the values at the time of creation 170 * of a {@link Parameter} is an important aid to producing valid SBML. Knowledge 171 * of the intented SBML Level and Version determine whether it is valid 172 * to assign a particular value to an attribute, or whether it is valid 173 * to add an object to an existing {@link SBMLDocument}. 174 */ public 175 Parameter(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 176 this(libsbmlJNI.new_Parameter__SWIG_0(level, version), true); 177 } 178 179 180/** 181 * Creates a new {@link Parameter} using the given {@link SBMLNamespaces} object 182 * <code>sbmlns</code>. 183 <p> 184 * <p> 185 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 186 * information. It is used to communicate the SBML Level, Version, and (in 187 * Level 3) packages used in addition to SBML Level 3 Core. A 188 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 189 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 190 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 191 <p> 192 * It is worth emphasizing that although this constructor does not take 193 * an identifier argument, in SBML Level 2 and beyond, the 'id' 194 * (identifier) attribute of a {@link Parameter} is required to have a value. 195 * Thus, callers are cautioned to assign a value after calling this 196 * constructor if no identifier is provided as an argument. Setting the 197 * identifier can be accomplished using the method 198 * setId(String id). 199 <p> 200 * @param sbmlns an {@link SBMLNamespaces} object. 201 <p> 202 * @throws SBMLConstructorException 203 * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind 204 * of SBML object, are either invalid or mismatched with respect to the 205 * parent {@link SBMLDocument} object. 206 <p> 207 * <p> 208 * @note Upon the addition of a {@link Parameter} object to an {@link SBMLDocument} 209 * (e.g., using {@link Model#addParameter(Parameter p)}), the SBML Level, SBML Version 210 * and XML namespace of the document <em>override</em> the values used 211 * when creating the {@link Parameter} object via this constructor. This is 212 * necessary to ensure that an SBML document is a consistent structure. 213 * Nevertheless, the ability to supply the values at the time of creation 214 * of a {@link Parameter} is an important aid to producing valid SBML. Knowledge 215 * of the intented SBML Level and Version determine whether it is valid 216 * to assign a particular value to an attribute, or whether it is valid 217 * to add an object to an existing {@link SBMLDocument}. 218 */ public 219 Parameter(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 220 this(libsbmlJNI.new_Parameter__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 221 } 222 223 224/** 225 * Copy constructor; creates a copy of a {@link Parameter}. 226 <p> 227 * @param orig the {@link Parameter} instance to copy. 228 <p> 229 * @throws SBMLConstructorException 230 * Thrown if the argument <code>orig</code> is <code>null.</code> 231 */ public 232 Parameter(Parameter orig) throws org.sbml.libsbml.SBMLConstructorException { 233 this(libsbmlJNI.new_Parameter__SWIG_2(Parameter.getCPtr(orig), orig), true); 234 } 235 236 237/** 238 * Creates and returns a deep copy of this {@link Parameter}. 239 <p> 240 * @return a (deep) copy of this {@link Parameter}. 241 */ public 242 Parameter cloneObject() { 243 long cPtr = libsbmlJNI.Parameter_cloneObject(swigCPtr, this); 244 return (cPtr == 0) ? null : new Parameter(cPtr, true); 245 } 246 247 248/** 249 * Initializes the fields of this {@link Parameter} object to 'typical' defaults 250 * values. 251 <p> 252 * The SBML {@link Parameter} component has slightly different aspects and 253 * default attribute values in different SBML Levels and Versions. Many 254 * SBML object classes defined by libSBML have an initDefaults() method 255 * to set the values to certain common defaults, based mostly on what 256 * they are in SBML Level 2. In the case of {@link Parameter}, this method 257 * only sets the value of the 'constant' attribute to <code>true.</code> 258 <p> 259 * @see #getConstant() 260 * @see #isSetConstant() 261 * @see #setConstant(boolean flag) 262 */ public 263 void initDefaults() { 264 libsbmlJNI.Parameter_initDefaults(swigCPtr, this); 265 } 266 267 268/** 269 * Returns the value of the 'id' attribute of this {@link Parameter}. 270 <p> 271 * @return the id of this {@link Parameter}. 272 */ public 273 String getId() { 274 return libsbmlJNI.Parameter_getId(swigCPtr, this); 275 } 276 277 278/** 279 * Returns the value of the 'name' attribute of this {@link Parameter}. 280 <p> 281 * @return the name of this {@link Parameter}. 282 */ public 283 String getName() { 284 return libsbmlJNI.Parameter_getName(swigCPtr, this); 285 } 286 287 288/** 289 * Gets the numerical value of this {@link Parameter}. 290 <p> 291 * @return the value of the 'value' attribute of this {@link Parameter}, as a 292 * number of type <code>double.</code> 293 <p> 294 * @note <b>It is crucial</b> that callers not blindly call 295 * {@link Parameter#getValue()} without first using {@link Parameter#isSetValue()} to 296 * determine whether a value has ever been set. Otherwise, the value 297 * return by {@link Parameter#getValue()} may not actually represent a value 298 * assigned to the parameter. The reason is simply that the data type 299 * <code>double</code> in a program always has <em>some</em> value. A separate test is 300 * needed to determine whether the value is a true model value, or 301 * uninitialized data in a computer's memory location. 302 <p> 303 * @see #isSetValue() 304 * @see #setValue(double value) 305 * @see #getUnits() 306 */ public 307 double getValue() { 308 return libsbmlJNI.Parameter_getValue(swigCPtr, this); 309 } 310 311 312/** 313 * Gets the units defined for this {@link Parameter}. 314 <p> 315 * The value of an SBML parameter's 'units' attribute establishes the 316 * unit of measurement associated with the parameter's value. 317 <p> 318 * @return the value of the 'units' attribute of this {@link Parameter}, as a 319 * string. An empty string indicates that no units have been assigned. 320 <p> 321 * <p> 322 * @note There is an important distinction to be made between <em>no units 323 * assigned</em>, and assuming a value without units has any specific unit 324 * such as <code>dimensionless</code>. In SBML, default units are never 325 * attributed to numbers, and numbers without units are not automatically 326 * assumed to have the unit <code>dimensionless</code>. Please consult the 327 * relevant SBML specification document for a more in-depth explanation of 328 * this topic and the SBML unit system. 329 <p> 330 * @see #isSetUnits() 331 * @see #setUnits(String units) 332 * @see #getValue() 333 */ public 334 String getUnits() { 335 return libsbmlJNI.Parameter_getUnits(swigCPtr, this); 336 } 337 338 339/** 340 * Gets the value of the 'constant' attribute of this {@link Parameter} instance. 341 <p> 342 * @return <code>true</code> if this {@link Parameter} is declared as being constant, 343 * <code>false</code> otherwise. 344 <p> 345 * <p> 346 * @note Readers who view the documentation for {@link LocalParameter} may be 347 * confused about the presence of this method. LibSBML derives 348 * {@link LocalParameter} from {@link Parameter}; however, this does not precisely match 349 * the object hierarchy defined by SBML Level 3, where 350 * {@link LocalParameter} is derived directly from {@link SBase} and not {@link Parameter}. We 351 * believe this arrangement makes it easier for libSBML users to program 352 * applications that work with both SBML Level 2 and SBML 353 * Level 3, but programmers should also keep in mind this difference 354 * exists. A side-effect of libSBML's scheme is that certain methods on 355 * {@link LocalParameter} that are inherited from {@link Parameter} do not actually have 356 * relevance to {@link LocalParameter} objects. An example of this is the 357 * methods pertaining to {@link Parameter}'s attribute 'constant' (i.e., 358 * isSetConstant(), setConstant(), and getConstant()). 359 <p> 360 * @see #isSetConstant() 361 * @see #setConstant(boolean flag) 362 */ public 363 boolean getConstant() { 364 return libsbmlJNI.Parameter_getConstant(swigCPtr, this); 365 } 366 367 368/** 369 * Predicate returning <code>true</code> if this 370 * {@link Parameter}'s 'id' attribute is set. 371 <p> 372 * @return <code>true</code> if the 'id' attribute of this {@link Parameter} is 373 * set, <code>false</code> otherwise. 374 */ public 375 boolean isSetId() { 376 return libsbmlJNI.Parameter_isSetId(swigCPtr, this); 377 } 378 379 380/** 381 * Predicate returning <code>true</code> if this 382 * {@link Parameter}'s 'name' attribute is set. 383 <p> 384 * @return <code>true</code> if the 'name' attribute of this {@link Parameter} is 385 * set, <code>false</code> otherwise. 386 */ public 387 boolean isSetName() { 388 return libsbmlJNI.Parameter_isSetName(swigCPtr, this); 389 } 390 391 392/** 393 * Predicate returning <code>true</code> if the 394 * 'value' attribute of this {@link Parameter} is set. 395 <p> 396 * In SBML definitions after SBML Level 1 Version 1, 397 * parameter values are optional and have no defaults. If a model read 398 * from a file does not contain a setting for the 'value' attribute of a 399 * parameter, its value is considered unset; it does not default to any 400 * particular value. Similarly, when a {@link Parameter} object is created in 401 * libSBML, it has no value until given a value. The 402 * {@link Parameter#isSetValue()} method allows calling applications to 403 * determine whether a given parameter's value has ever been set. 404 <p> 405 * In SBML Level 1 Version 1, parameters are required to have 406 * values and therefore, the value of a {@link Parameter} <b>should always be 407 * set</b>. In Level 1 Version 2 and beyond, the value is 408 * optional and as such, the 'value' attribute may or may not be set. 409 <p> 410 * @return <code>true</code> if the value of this {@link Parameter} is set, 411 * <code>false</code> otherwise. 412 <p> 413 * @see #getValue() 414 * @see #setValue(double value) 415 */ public 416 boolean isSetValue() { 417 return libsbmlJNI.Parameter_isSetValue(swigCPtr, this); 418 } 419 420 421/** 422 * Predicate returning <code>true</code> if the 423 * 'units' attribute of this {@link Parameter} is set. 424 <p> 425 * @return <code>true</code> if the 'units' attribute of this {@link Parameter} is 426 * set, <code>false</code> otherwise. 427 <p> 428 * <p> 429 * @note There is an important distinction to be made between <em>no units 430 * assigned</em>, and assuming a value without units has any specific unit 431 * such as <code>dimensionless</code>. In SBML, default units are never 432 * attributed to numbers, and numbers without units are not automatically 433 * assumed to have the unit <code>dimensionless</code>. Please consult the 434 * relevant SBML specification document for a more in-depth explanation of 435 * this topic and the SBML unit system. 436 */ public 437 boolean isSetUnits() { 438 return libsbmlJNI.Parameter_isSetUnits(swigCPtr, this); 439 } 440 441 442/** 443 * Predicate returning <code>true</code> if the 444 * 'constant' attribute of this {@link Parameter} is set. 445 <p> 446 * @return <code>true</code> if the 'constant' attribute of this {@link Parameter} is 447 * set, <code>false</code> otherwise. 448 <p> 449 * <p> 450 * @note Readers who view the documentation for {@link LocalParameter} may be 451 * confused about the presence of this method. LibSBML derives 452 * {@link LocalParameter} from {@link Parameter}; however, this does not precisely match 453 * the object hierarchy defined by SBML Level 3, where 454 * {@link LocalParameter} is derived directly from {@link SBase} and not {@link Parameter}. We 455 * believe this arrangement makes it easier for libSBML users to program 456 * applications that work with both SBML Level 2 and SBML 457 * Level 3, but programmers should also keep in mind this difference 458 * exists. A side-effect of libSBML's scheme is that certain methods on 459 * {@link LocalParameter} that are inherited from {@link Parameter} do not actually have 460 * relevance to {@link LocalParameter} objects. An example of this is the 461 * methods pertaining to {@link Parameter}'s attribute 'constant' (i.e., 462 * isSetConstant(), setConstant(), and getConstant()). 463 <p> 464 * @see #getConstant() 465 * @see #setConstant(boolean flag) 466 */ public 467 boolean isSetConstant() { 468 return libsbmlJNI.Parameter_isSetConstant(swigCPtr, this); 469 } 470 471 472/** 473 * Sets the value of the 'id' attribute of this {@link Parameter}. 474 <p> 475 * The string <code>sid</code> is copied. 476 <p> 477 * <p> 478 * SBML has strict requirements for the syntax of identifiers, that is, the 479 * values of the 'id' attribute present on most types of SBML objects. 480 * The following is a summary of the definition of the SBML identifier type 481 * <code>SId</code>, which defines the permitted syntax of identifiers. We 482 * express the syntax using an extended form of BNF notation: 483 * <pre style='margin-left: 2em; border: none; font-weight: bold; font-size: 13px; color: black'> 484 * letter .= 'a'..'z','A'..'Z' 485 * digit .= '0'..'9' 486 * idChar .= letter | digit | '_' 487 * SId .= ( letter | '_' ) idChar* 488 * </pre> 489 * The characters <code>(</code> and <code>)</code> are used for grouping, the 490 * character <code>*</code> 'zero or more times', and the character 491 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers is 492 * determined by an exact character sequence match; i.e., comparisons must be 493 * performed in a case-sensitive manner. In addition, there are a few 494 * conditions for the uniqueness of identifiers in an SBML model. Please 495 * consult the SBML specifications for the exact details of the uniqueness 496 * requirements. 497 <p> 498 * @param sid the string to use as the identifier of this {@link Parameter} 499 <p> 500 * @return integer value indicating success/failure of the 501 * function. The possible values returned by this function are: 502 * <ul> 503 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 504 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 505 * </ul> 506 */ public 507 int setId(String sid) { 508 return libsbmlJNI.Parameter_setId(swigCPtr, this, sid); 509 } 510 511 512/** 513 * Sets the value of the 'name' attribute of this {@link Parameter}. 514 <p> 515 * The string in <code>name</code> is copied. 516 <p> 517 * @param name the new name for the {@link Parameter} 518 <p> 519 * @return integer value indicating success/failure of the 520 * function. The possible values 521 * returned by this function are: 522 * <ul> 523 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 524 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 525 * </ul> 526 */ public 527 int setName(String name) { 528 return libsbmlJNI.Parameter_setName(swigCPtr, this, name); 529 } 530 531 532/** 533 * Sets the 'value' attribute of this {@link Parameter} to the given <code>double</code> 534 * value and marks the attribute as set. 535 <p> 536 * @param value a <code>double</code>, the value to assign 537 <p> 538 * @return integer value indicating success/failure of the 539 * function. The possible values 540 * returned by this function are: 541 * <ul> 542 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 543 * </ul> 544 */ public 545 int setValue(double value) { 546 return libsbmlJNI.Parameter_setValue(swigCPtr, this, value); 547 } 548 549 550/** 551 * Sets the 'units' attribute of this {@link Parameter} to a copy of the given 552 * units identifier <code>units</code>. 553 <p> 554 * @param units a string, the identifier of the units to assign to this 555 * {@link Parameter} instance 556 <p> 557 * @return integer value indicating success/failure of the 558 * function. The possible values 559 * returned by this function are: 560 * <ul> 561 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 562 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 563 * </ul> 564 */ public 565 int setUnits(String units) { 566 return libsbmlJNI.Parameter_setUnits(swigCPtr, this, units); 567 } 568 569 570/** 571 * Sets the 'constant' attribute of this {@link Parameter} to the given boolean 572 * <code>flag</code>. 573 <p> 574 * @param flag a boolean, the value for the 'constant' attribute of this 575 * {@link Parameter} instance 576 <p> 577 * @return integer value indicating success/failure of the 578 * function. The possible values 579 * returned by this function are: 580 * <ul> 581 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 582 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 583 * 584 * </ul> <p> 585 * <p> 586 * @note Readers who view the documentation for {@link LocalParameter} may be 587 * confused about the presence of this method. LibSBML derives 588 * {@link LocalParameter} from {@link Parameter}; however, this does not precisely match 589 * the object hierarchy defined by SBML Level 3, where 590 * {@link LocalParameter} is derived directly from {@link SBase} and not {@link Parameter}. We 591 * believe this arrangement makes it easier for libSBML users to program 592 * applications that work with both SBML Level 2 and SBML 593 * Level 3, but programmers should also keep in mind this difference 594 * exists. A side-effect of libSBML's scheme is that certain methods on 595 * {@link LocalParameter} that are inherited from {@link Parameter} do not actually have 596 * relevance to {@link LocalParameter} objects. An example of this is the 597 * methods pertaining to {@link Parameter}'s attribute 'constant' (i.e., 598 * isSetConstant(), setConstant(), and getConstant()). 599 <p> 600 * @see #getConstant() 601 * @see #isSetConstant() 602 */ public 603 int setConstant(boolean flag) { 604 return libsbmlJNI.Parameter_setConstant(swigCPtr, this, flag); 605 } 606 607 608/** 609 * Unsets the value of the 'name' attribute of this {@link Parameter}. 610 <p> 611 * @return integer value indicating success/failure of the 612 * function. The possible values 613 * returned by this function are: 614 * <ul> 615 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 616 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 617 * </ul> 618 */ public 619 int unsetName() { 620 return libsbmlJNI.Parameter_unsetName(swigCPtr, this); 621 } 622 623 624/** 625 * Unsets the 'value' attribute of this {@link Parameter} instance. 626 <p> 627 * @return integer value indicating success/failure of the 628 * function. The possible values 629 * returned by this function are: 630 * <ul> 631 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 632 * 633 * </ul> <p> 634 * In SBML Level 1 Version 1, parameters are required to have 635 * values and therefore, the value of a {@link Parameter} <b>should always be 636 * set</b>. In SBML Level 1 Version 2 and beyond, the value 637 * is optional and as such, the 'value' attribute may or may not be set. 638 */ public 639 int unsetValue() { 640 return libsbmlJNI.Parameter_unsetValue(swigCPtr, this); 641 } 642 643 644/** 645 * Unsets the 'units' attribute of this {@link Parameter} instance. 646 <p> 647 * @return integer value indicating success/failure of the 648 * function. The possible values 649 * returned by this function are: 650 * <ul> 651 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 652 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 653 * </ul> 654 */ public 655 int unsetUnits() { 656 return libsbmlJNI.Parameter_unsetUnits(swigCPtr, this); 657 } 658 659 660/** 661 * Constructs and returns a {@link UnitDefinition} that corresponds to the units 662 * of this {@link Parameter}'s value. 663 <p> 664 * Parameters in SBML have an attribute ('units') for declaring the units 665 * of measurement intended for the parameter's value. <b>No defaults are 666 * defined</b> by SBML in the absence of a definition for 'units'. This 667 * method returns a {@link UnitDefinition} object based on the units declared for 668 * this {@link Parameter} using its 'units' attribute, or it returns <code>null</code> if 669 * no units have been declared. 670 <p> 671 * Note that unit declarations for {@link Parameter} objects are specified in 672 * terms of the <em>identifier</em> of a unit (e.g., using setUnits()), but 673 * <em>this</em> method returns a {@link UnitDefinition} object, not a unit 674 * identifier. It does this by constructing an appropriate 675 * {@link UnitDefinition}.For SBML Level 2 models, it will do this even when 676 * the value of the 'units' attribute is one of the special SBML 677 * Level 2 unit identifiers <code>'substance'</code>, <code>'volume'</code>, <code>'area'</code>, 678 * <code>'length'</code> or <code>'time'.</code> Callers may find this useful in conjunction 679 * with the helper methods provided by the {@link UnitDefinition} class for 680 * comparing different {@link UnitDefinition} objects. 681 <p> 682 * @return a {@link UnitDefinition} that expresses the units of this 683 * {@link Parameter}, or <code>null</code> if one cannot be constructed. 684 <p> 685 * @note The libSBML system for unit analysis depends on the model as a 686 * whole. In cases where the {@link Parameter} object has not yet been added to 687 * a model, or the model itself is incomplete, unit analysis is not 688 * possible, and consequently this method will return <code>null.</code> 689 <p> 690 * @see #isSetUnits() 691 */ public 692 UnitDefinition getDerivedUnitDefinition() { 693 long cPtr = libsbmlJNI.Parameter_getDerivedUnitDefinition__SWIG_0(swigCPtr, this); 694 return (cPtr == 0) ? null : new UnitDefinition(cPtr, false); 695 } 696 697 698/** 699 * Returns the libSBML type code for this SBML object. 700 <p> 701 * <p> 702 * LibSBML attaches an identifying code to every kind of SBML object. These 703 * are integer constants known as <em>SBML type codes</em>. The names of all 704 * the codes begin with the characters “<code>SBML_</code>”. 705 * In the Java language interface for libSBML, the 706 * type codes are defined as static integer constants in the interface class 707 * {@link libsbmlConstants}. Note that different Level 3 708 * package plug-ins may use overlapping type codes; to identify the package 709 * to which a given object belongs, call the <code>getPackageName()</code> 710 * method on the object. 711 <p> 712 * @return the SBML type code for this object: 713 * {@link libsbmlConstants#SBML_PARAMETER SBML_PARAMETER} (default). 714 <p> 715 * <p> 716 * @warning <span class='warning'>The specific integer values of the possible 717 * type codes may be reused by different Level 3 package plug-ins. 718 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 719 * both getTypeCode() and getPackageName()</strong>.</span> 720 <p> 721 * @see #getElementName() 722 * @see #getPackageName() 723 */ public 724 int getTypeCode() { 725 return libsbmlJNI.Parameter_getTypeCode(swigCPtr, this); 726 } 727 728 729/** 730 * Returns the XML element name of this object, which for {@link Parameter}, is 731 * always <code>'parameter'.</code> 732 <p> 733 * @return the name of this element, i.e., <code>'parameter'.</code> 734 */ public 735 String getElementName() { 736 return libsbmlJNI.Parameter_getElementName(swigCPtr, this); 737 } 738 739 740/** 741 * Predicate returning <code>true</code> if 742 * all the required attributes for this {@link Parameter} object 743 * have been set. 744 <p> 745 * @note The required attributes for a {@link Parameter} object are: 746 * <ul> 747 * <li> 'id' (or 'name' in SBML Level 1) 748 * <li> 'value' (required in Level 1, optional otherwise) 749 * 750 * </ul> <p> 751 * @return a boolean value indicating whether all the required 752 * attributes for this object have been defined. 753 */ public 754 boolean hasRequiredAttributes() { 755 return libsbmlJNI.Parameter_hasRequiredAttributes(swigCPtr, this); 756 } 757 758 759/** 760 * Renames all the <code>UnitSIdRef</code> attributes on this element. 761 <p> 762 * <p> 763 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>. In 764 * SBML Level 3, an explicit data type called <code>UnitSIdRef</code> was 765 * introduced for attribute values that refer to <code>UnitSId</code> values; in 766 * previous Levels of SBML, this data type did not exist and attributes were 767 * simply described to as 'referring to a unit identifier', but the effective 768 * data type was the same as <code>UnitSIdRef</code> in Level 3. These and 769 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all 770 * Levels of SBML, even if the corresponding SBML specification did not 771 * explicitly name the data type. 772 <p> 773 * This method works by looking at all unit identifier attribute values 774 * (including, if appropriate, inside mathematical formulas), comparing the 775 * unit identifiers to the value of <code>oldid</code>. If any matches are found, 776 * the matching identifiers are replaced with <code>newid</code>. The method does 777 * <em>not</em> descend into child elements. 778 <p> 779 * @param oldid the old identifier 780 * @param newid the new identifier 781 */ public 782 void renameUnitSIdRefs(String oldid, String newid) { 783 libsbmlJNI.Parameter_renameUnitSIdRefs(swigCPtr, this, oldid, newid); 784 } 785 786 787/** * @internal */ public 788 void setCalculatingUnits(boolean calculatingUnits) { 789 libsbmlJNI.Parameter_setCalculatingUnits(swigCPtr, this, calculatingUnits); 790 } 791 792}