001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.11 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 * 013 * Implementation of SBML's Parameter construct. 014 * <p> 015 * A {@link Parameter} is used in SBML to define a symbol associated with a value; 016 * this symbol can then be used in mathematical formulas in a model. By 017 * default, parameters have constant value for the duration of a 018 * simulation, and for this reason are called <em>parameters</em> instead of 019 * <em>variables</em> in SBML, although it is crucial to understand that <em>SBML 020 * parameters represent both concepts</em>. Whether a given SBML 021 * parameter is intended to be constant or variable is indicated by the 022 * value of its 'constant' attribute. 023 * <p> 024 * SBML's {@link Parameter} has a required attribute, 'id', that gives the 025 * parameter a unique identifier by which other parts of an SBML model 026 * definition can refer to it. A parameter can also have an optional 027 * 'name' attribute of type <code>string.</code> Identifiers and names must be used 028 * according to the guidelines described in the SBML specifications. 029 * <p> 030 * The optional attribute 'value' determines the value (of type <code>double</code>) 031 * assigned to the parameter. A missing value for 'value' implies that 032 * the value either is unknown, or to be obtained from an external source, 033 * or determined by an initial assignment. The unit of measurement 034 * associated with the value of the parameter can be specified using the 035 * optional attribute 'units'. Here we only mention briefly some notable 036 * points about the possible unit choices, but readers are urged to consult 037 * the SBML specification documents for more information: 038 * <ul> 039 * <p> 040 * <li> In SBML Level 3, there are no constraints on the units that 041 * can be assigned to parameters in a model; there are also no units to 042 * inherit from the enclosing {@link Model} object (unlike the case for, e.g., 043 * {@link Species} and {@link Compartment}). 044 * <p> 045 * <li> In SBML Level 2, the value assigned to the parameter's 'units' 046 * attribute must be chosen from one of the following possibilities: one of 047 * the base unit identifiers defined in SBML; one of the built-in unit 048 * identifiers <code>'substance'</code>, <code>'time'</code>, <code>'volume'</code>, <code>'area'</code> or 049 * <code>'length'</code>; or the identifier of a new unit defined in the list of unit 050 * definitions in the enclosing {@link Model} structure. There are no constraints 051 * on the units that can be chosen from these sets. There are no default 052 * units for parameters. 053 * </ul> 054 * <p> 055 * The {@link Parameter} structure has another boolean attribute named 'constant' 056 * that is used to indicate whether the parameter's value can vary during a 057 * simulation. (In SBML Level 3, the attribute is mandatory and must 058 * be given a value; in SBML Levels below Level 3, the attribute is 059 * optional.) A value of <code>true</code> indicates the parameter's value cannot be 060 * changed by any construct except {@link InitialAssignment}. Conversely, if the 061 * value of 'constant' is <code>false</code>, other constructs in SBML, such as rules 062 * and events, can change the value of the parameter. 063 * <p> 064 * SBML Level 3 uses a separate object class, {@link LocalParameter}, for 065 * parameters that are local to a {@link Reaction}'s {@link KineticLaw}. In Levels prior 066 * to SBML Level 3, the {@link Parameter} class is used both for definitions 067 * of global parameters, as well as reaction-local parameters stored in a 068 * list within {@link KineticLaw} objects. {@link Parameter} objects that are local to a 069 * reaction (that is, those defined within the {@link KineticLaw} structure of a 070 * {@link Reaction}) cannot be changed by rules and therefore are <em>implicitly 071 * always constant</em>; consequently, in SBML Level 2, parameter 072 * definitions within {@link Reaction} structures should <em>not</em> have their 073 * 'constant' attribute set to <code>false.</code> 074 * <p> 075 * What if a global parameter has its 'constant' attribute set to <code>false</code>, 076 * but the model does not contain any rules, events or other constructs 077 * that ever change its value over time? Although the model may be 078 * suspect, this situation is not strictly an error. A value of <code>false</code> 079 * for 'constant' only indicates that a parameter <em>can</em> change value, not 080 * that it <em>must</em>. 081 * <p> 082 * As with all other major SBML components, {@link Parameter} is derived from 083 * {@link SBase}, and the methods defined on {@link SBase} are available on {@link Parameter}. 084 * <p> 085 * @note The use of the term <em>parameter</em> in SBML sometimes leads to 086 * confusion among readers who have a particular notion of what something 087 * called 'parameter' should be. It has been the source of heated debate, 088 * but despite this, no one has yet found an adequate replacement term that 089 * does not have different connotations to different people and hence leads 090 * to confusion among <em>some</em> subset of users. Perhaps it would have been 091 * better to have two constructs, one called <em>constants</em> and the other 092 * called <em>variables</em>. The current approach in SBML is simply more 093 * parsimonious, using a single {@link Parameter} construct with the boolean flag 094 * 'constant' indicating which flavor it is. In any case, readers are 095 * implored to look past their particular definition of a <em>parameter</em> and 096 * simply view SBML's {@link Parameter} as a single mechanism for defining both 097 * constants and (additional) variables in a model. (We write 098 * <em>additional</em> because the species in a model are usually considered to be 099 * the central variables.) After all, software tools are not required to 100 * expose to users the actual names of particular SBML constructs, and 101 * thus tools can present to their users whatever terms their designers 102 * feel best matches their target audience. 103 * <p> 104 * @see ListOfParameters 105 * <p> 106 * <!-- leave this next break as-is to work around some doxygen bug --> 107 */ 108 109public class Parameter extends SBase { 110 private long swigCPtr; 111 112 protected Parameter(long cPtr, boolean cMemoryOwn) 113 { 114 super(libsbmlJNI.Parameter_SWIGUpcast(cPtr), cMemoryOwn); 115 swigCPtr = cPtr; 116 } 117 118 protected static long getCPtr(Parameter obj) 119 { 120 return (obj == null) ? 0 : obj.swigCPtr; 121 } 122 123 protected static long getCPtrAndDisown (Parameter obj) 124 { 125 long ptr = 0; 126 127 if (obj != null) 128 { 129 ptr = obj.swigCPtr; 130 obj.swigCMemOwn = false; 131 } 132 133 return ptr; 134 } 135 136 protected void finalize() { 137 delete(); 138 } 139 140 public synchronized void delete() { 141 if (swigCPtr != 0) { 142 if (swigCMemOwn) { 143 swigCMemOwn = false; 144 libsbmlJNI.delete_Parameter(swigCPtr); 145 } 146 swigCPtr = 0; 147 } 148 super.delete(); 149 } 150 151 152/** 153 * Creates a new {@link Parameter} using the given SBML <code>level</code> and <code>version</code> 154 * values. 155 * <p> 156 * @param level a long integer, the SBML Level to assign to this {@link Parameter} 157 * <p> 158 * @param version a long integer, the SBML Version to assign to this 159 * {@link Parameter} 160 * <p> 161 * @throws SBMLConstructorException 162 * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind 163 * of SBML object, are either invalid or mismatched with respect to the 164 * parent {@link SBMLDocument} object. 165 * <p> 166 * @note Upon the addition of a {@link Parameter} object to an {@link SBMLDocument} 167 * (e.g., using {@link Model#addParameter(Parameter p)}), the SBML Level, SBML Version 168 * and XML namespace of the document <em>override</em> the values used 169 * when creating the {@link Parameter} object via this constructor. This is 170 * necessary to ensure that an SBML document is a consistent structure. 171 * Nevertheless, the ability to supply the values at the time of creation 172 * of a {@link Parameter} is an important aid to producing valid SBML. Knowledge 173 * of the intented SBML Level and Version determine whether it is valid 174 * to assign a particular value to an attribute, or whether it is valid 175 * to add an object to an existing {@link SBMLDocument}. 176 */ public 177 Parameter(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 178 this(libsbmlJNI.new_Parameter__SWIG_0(level, version), true); 179 } 180 181 182/** 183 * Creates a new {@link Parameter} using the given {@link SBMLNamespaces} object 184 * <code>sbmlns</code>. 185 * <p> 186 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 187 * information. It is used to communicate the SBML Level, Version, and 188 * (in Level 3) packages used in addition to SBML Level 3 Core. 189 * A common approach to using this class constructor is to create an 190 * {@link SBMLNamespaces} object somewhere in a program, once, then pass it to 191 * object constructors such as this one when needed. 192 * <p> 193 * It is worth emphasizing that although this constructor does not take 194 * an identifier argument, in SBML Level 2 and beyond, the 'id' 195 * (identifier) attribute of a {@link Parameter} is required to have a value. 196 * Thus, callers are cautioned to assign a value after calling this 197 * constructor if no identifier is provided as an argument. Setting the 198 * identifier can be accomplished using the method 199 * setId(String id). 200 * <p> 201 * @param sbmlns an {@link SBMLNamespaces} object. 202 * <p> 203 * @throws SBMLConstructorException 204 * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind 205 * of SBML object, are either invalid or mismatched with respect to the 206 * parent {@link SBMLDocument} object. 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 XML namespace of the 210 * document <em>overrides</em> the value used when creating the {@link Parameter} 211 * object via this constructor. This is necessary to ensure that an SBML 212 * document is a consistent structure. Nevertheless, the ability to 213 * supply the values at the time of creation of a {@link Parameter} is an 214 * important aid to producing valid SBML. Knowledge of the intented SBML 215 * Level and Version determine whether it is valid to assign a particular 216 * value to an attribute, or whether it is valid to add an object to an 217 * 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 * @note There is an important distinction to be made between <em>no units 322assigned</em>, and assuming a value without units has any specific unit 323such as <code>dimensionless</code>. In SBML, default units are never 324attributed to numbers, and numbers without units are not automatically 325assumed to have the unit <code>dimensionless</code>. Please consult the 326relevant SBML specification document for a more in-depth explanation of 327this topic and the SBML unit system. 328 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 * @note Readers who view the documentation for {@link LocalParameter} may be 346 * confused about the presence of this method. LibSBML derives 347 * {@link LocalParameter} from {@link Parameter}; however, this does not precisely match 348 * the object hierarchy defined by SBML Level 3, where 349 * {@link LocalParameter} is derived directly from {@link SBase} and not {@link Parameter}. We 350 * believe this arrangement makes it easier for libSBML users to program 351 * applications that work with both SBML Level 2 and SBML 352 * Level 3, but programmers should also keep in mind this difference 353 * exists. A side-effect of libSBML's scheme is that certain methods on 354 * {@link LocalParameter} that are inherited from {@link Parameter} do not actually have 355 * relevance to {@link LocalParameter} objects. An example of this is the 356 * methods pertaining to {@link Parameter}'s attribute 'constant' (i.e., 357 * isSetConstant(), setConstant(), and getConstant()). 358 * <p> 359 * @see #isSetConstant() 360 * @see #setConstant(boolean flag) 361 */ public 362 boolean getConstant() { 363 return libsbmlJNI.Parameter_getConstant(swigCPtr, this); 364 } 365 366 367/** 368 * Predicate returning <code>true</code> if this 369 * {@link Parameter}'s 'id' attribute is set. 370 * <p> 371 * @return <code>true</code> if the 'id' attribute of this {@link Parameter} is 372 * set, <code>false</code> otherwise. 373 */ public 374 boolean isSetId() { 375 return libsbmlJNI.Parameter_isSetId(swigCPtr, this); 376 } 377 378 379/** 380 * Predicate returning <code>true</code> if this 381 * {@link Parameter}'s 'name' attribute is set. 382 * <p> 383 * @return <code>true</code> if the 'name' attribute of this {@link Parameter} is 384 * set, <code>false</code> otherwise. 385 */ public 386 boolean isSetName() { 387 return libsbmlJNI.Parameter_isSetName(swigCPtr, this); 388 } 389 390 391/** 392 * Predicate returning <code>true</code> if the 393 * 'value' attribute of this {@link Parameter} is set. 394 * <p> 395 * In SBML definitions after SBML Level 1 Version 1, 396 * parameter values are optional and have no defaults. If a model read 397 * from a file does not contain a setting for the 'value' attribute of a 398 * parameter, its value is considered unset; it does not default to any 399 * particular value. Similarly, when a {@link Parameter} object is created in 400 * libSBML, it has no value until given a value. The 401 * {@link Parameter#isSetValue()} method allows calling applications to 402 * determine whether a given parameter's value has ever been set. 403 * <p> 404 * In SBML Level 1 Version 1, parameters are required to have 405 * values and therefore, the value of a {@link Parameter} <b>should always be 406 * set</b>. In Level 1 Version 2 and beyond, the value is 407 * optional and as such, the 'value' attribute may or may not be set. 408 * <p> 409 * @return <code>true</code> if the value of this {@link Parameter} is set, 410 * <code>false</code> otherwise. 411 * <p> 412 * @see #getValue() 413 * @see #setValue(double value) 414 */ public 415 boolean isSetValue() { 416 return libsbmlJNI.Parameter_isSetValue(swigCPtr, this); 417 } 418 419 420/** 421 * Predicate returning <code>true</code> if the 422 * 'units' attribute of this {@link Parameter} is set. 423 * <p> 424 * @return <code>true</code> if the 'units' attribute of this {@link Parameter} is 425 * set, <code>false</code> otherwise. 426 * <p> 427 * @note There is an important distinction to be made between <em>no units 428assigned</em>, and assuming a value without units has any specific unit 429such as <code>dimensionless</code>. In SBML, default units are never 430attributed to numbers, and numbers without units are not automatically 431assumed to have the unit <code>dimensionless</code>. Please consult the 432relevant SBML specification document for a more in-depth explanation of 433this topic and the SBML unit system. 434 435 */ public 436 boolean isSetUnits() { 437 return libsbmlJNI.Parameter_isSetUnits(swigCPtr, this); 438 } 439 440 441/** 442 * Predicate returning <code>true</code> if the 443 * 'constant' attribute of this {@link Parameter} is set. 444 * <p> 445 * @return <code>true</code> if the 'constant' attribute of this {@link Parameter} is 446 * set, <code>false</code> otherwise. 447 * <p> 448 * @note Readers who view the documentation for {@link LocalParameter} may be 449 * confused about the presence of this method. LibSBML derives 450 * {@link LocalParameter} from {@link Parameter}; however, this does not precisely match 451 * the object hierarchy defined by SBML Level 3, where 452 * {@link LocalParameter} is derived directly from {@link SBase} and not {@link Parameter}. We 453 * believe this arrangement makes it easier for libSBML users to program 454 * applications that work with both SBML Level 2 and SBML 455 * Level 3, but programmers should also keep in mind this difference 456 * exists. A side-effect of libSBML's scheme is that certain methods on 457 * {@link LocalParameter} that are inherited from {@link Parameter} do not actually have 458 * relevance to {@link LocalParameter} objects. An example of this is the 459 * methods pertaining to {@link Parameter}'s attribute 'constant' (i.e., 460 * isSetConstant(), setConstant(), and getConstant()). 461 * <p> 462 * @see #getConstant() 463 * @see #setConstant(boolean flag) 464 */ public 465 boolean isSetConstant() { 466 return libsbmlJNI.Parameter_isSetConstant(swigCPtr, this); 467 } 468 469 470/** 471 * Sets the value of the 'id' attribute of this {@link Parameter}. 472 * <p> 473 * The string <code>sid</code> is copied. Note that SBML has strict requirements 474 * for the syntax of identifiers. The following is a summary of the definition of the SBML identifier type 475<code>SId</code>, which defines the permitted syntax of identifiers. We 476express the syntax using an extended form of BNF notation: 477<pre style='margin-left: 2em; border: none; font-weight: bold; font-size: 13px; color: black'> 478letter .= 'a'..'z','A'..'Z' 479digit .= '0'..'9' 480idChar .= letter | digit | '_' 481SId .= ( letter | '_' ) idChar* 482</pre> 483The characters <code>(</code> and <code>)</code> are used for grouping, the 484character <code>*</code> 'zero or more times', and the character 485<code>|</code> indicates logical 'or'. The equality of SBML identifiers is 486determined by an exact character sequence match; i.e., comparisons must be 487performed in a case-sensitive manner. In addition, there are a few 488conditions for the uniqueness of identifiers in an SBML model. Please 489consult the SBML specifications for the exact formulations. 490<p> 491 492 * <p> 493 * @param sid the string to use as the identifier of this {@link Parameter} 494 * <p> 495 * @return integer value indicating success/failure of the 496 * function. The possible values returned by this function are: 497 * <ul> 498 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 499 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 500 * </ul> 501 */ public 502 int setId(String sid) { 503 return libsbmlJNI.Parameter_setId(swigCPtr, this, sid); 504 } 505 506 507/** 508 * Sets the value of the 'name' attribute of this {@link Parameter}. 509 * <p> 510 * The string in <code>name</code> is copied. 511 * <p> 512 * @param name the new name for the {@link Parameter} 513 * <p> 514 * @return integer value indicating success/failure of the 515 * function. The possible values 516 * returned by this function are: 517 * <ul> 518 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 519 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 520 * </ul> 521 */ public 522 int setName(String name) { 523 return libsbmlJNI.Parameter_setName(swigCPtr, this, name); 524 } 525 526 527/** 528 * Sets the 'value' attribute of this {@link Parameter} to the given <code>double</code> 529 * value and marks the attribute as set. 530 * <p> 531 * @param value a <code>double</code>, the value to assign 532 * <p> 533 * @return integer value indicating success/failure of the 534 * function. The possible values 535 * returned by this function are: 536 * <ul> 537 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 538 * </ul> 539 */ public 540 int setValue(double value) { 541 return libsbmlJNI.Parameter_setValue(swigCPtr, this, value); 542 } 543 544 545/** 546 * Sets the 'units' attribute of this {@link Parameter} to a copy of the given 547 * units identifier <code>units</code>. 548 * <p> 549 * @param units a string, the identifier of the units to assign to this 550 * {@link Parameter} instance 551 * <p> 552 * @return integer value indicating success/failure of the 553 * function. The possible values 554 * returned by this function are: 555 * <ul> 556 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 557 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 558 * </ul> 559 */ public 560 int setUnits(String units) { 561 return libsbmlJNI.Parameter_setUnits(swigCPtr, this, units); 562 } 563 564 565/** 566 * Sets the 'constant' attribute of this {@link Parameter} to the given boolean 567 * <code>flag</code>. 568 * <p> 569 * @param flag a boolean, the value for the 'constant' attribute of this 570 * {@link Parameter} instance 571 * <p> 572 * @return integer value indicating success/failure of the 573 * function. The possible values 574 * returned by this function are: 575 * <ul> 576 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 577 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 578 * </ul> 579 * <p> 580 * @note Readers who view the documentation for {@link LocalParameter} may be 581 * confused about the presence of this method. LibSBML derives 582 * {@link LocalParameter} from {@link Parameter}; however, this does not precisely match 583 * the object hierarchy defined by SBML Level 3, where 584 * {@link LocalParameter} is derived directly from {@link SBase} and not {@link Parameter}. We 585 * believe this arrangement makes it easier for libSBML users to program 586 * applications that work with both SBML Level 2 and SBML 587 * Level 3, but programmers should also keep in mind this difference 588 * exists. A side-effect of libSBML's scheme is that certain methods on 589 * {@link LocalParameter} that are inherited from {@link Parameter} do not actually have 590 * relevance to {@link LocalParameter} objects. An example of this is the 591 * methods pertaining to {@link Parameter}'s attribute 'constant' (i.e., 592 * isSetConstant(), setConstant(), and getConstant()). 593 * <p> 594 * @see #getConstant() 595 * @see #isSetConstant() 596 */ public 597 int setConstant(boolean flag) { 598 return libsbmlJNI.Parameter_setConstant(swigCPtr, this, flag); 599 } 600 601 602/** 603 * Unsets the value of the 'name' attribute of this {@link Parameter}. 604 * <p> 605 * @return integer value indicating success/failure of the 606 * function. The possible values 607 * returned by this function are: 608 * <ul> 609 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 610 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 611 * </ul> 612 */ public 613 int unsetName() { 614 return libsbmlJNI.Parameter_unsetName(swigCPtr, this); 615 } 616 617 618/** 619 * Unsets the 'value' attribute of this {@link Parameter} instance. 620 * <p> 621 * @return integer value indicating success/failure of the 622 * function. The possible values 623 * returned by this function are: 624 * <ul> 625 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 626 * </ul> 627 * <p> 628 * In SBML Level 1 Version 1, parameters are required to have 629 * values and therefore, the value of a {@link Parameter} <b>should always be 630 * set</b>. In SBML Level 1 Version 2 and beyond, the value 631 * is optional and as such, the 'value' attribute may or may not be set. 632 */ public 633 int unsetValue() { 634 return libsbmlJNI.Parameter_unsetValue(swigCPtr, this); 635 } 636 637 638/** 639 * Unsets the 'units' attribute of this {@link Parameter} instance. 640 * <p> 641 * @return integer value indicating success/failure of the 642 * function. The possible values 643 * returned by this function are: 644 * <ul> 645 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 646 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 647 * </ul> 648 */ public 649 int unsetUnits() { 650 return libsbmlJNI.Parameter_unsetUnits(swigCPtr, this); 651 } 652 653 654/** 655 * Constructs and returns a {@link UnitDefinition} that corresponds to the units 656 * of this {@link Parameter}'s value. 657 * <p> 658 * Parameters in SBML have an attribute ('units') for declaring the units 659 * of measurement intended for the parameter's value. <b>No defaults are 660 * defined</b> by SBML in the absence of a definition for 'units'. This 661 * method returns a {@link UnitDefinition} object based on the units declared for 662 * this {@link Parameter} using its 'units' attribute, or it returns <code>null</code> if 663 * no units have been declared. 664 * <p> 665 * Note that unit declarations for {@link Parameter} objects are specified in 666 * terms of the <em>identifier</em> of a unit (e.g., using setUnits()), but 667 * <em>this</em> method returns a {@link UnitDefinition} object, not a unit 668 * identifier. It does this by constructing an appropriate 669 * {@link UnitDefinition}.For SBML Level 2 models, it will do this even when 670 * the value of the 'units' attribute is one of the special SBML 671 * Level 2 unit identifiers <code>'substance'</code>, <code>'volume'</code>, <code>'area'</code>, 672 * <code>'length'</code> or <code>'time'.</code> Callers may find this useful in conjunction 673 * with the helper methods provided by the {@link UnitDefinition} class for 674 * comparing different {@link UnitDefinition} objects. 675 * <p> 676 * @return a {@link UnitDefinition} that expresses the units of this 677 * {@link Parameter}, or <code>null</code> if one cannot be constructed. 678 * <p> 679 * @note The libSBML system for unit analysis depends on the model as a 680 * whole. In cases where the {@link Parameter} object has not yet been added to 681 * a model, or the model itself is incomplete, unit analysis is not 682 * possible, and consequently this method will return <code>null.</code> 683 * <p> 684 * @see #isSetUnits() 685 */ public 686 UnitDefinition getDerivedUnitDefinition() { 687 long cPtr = libsbmlJNI.Parameter_getDerivedUnitDefinition__SWIG_0(swigCPtr, this); 688 return (cPtr == 0) ? null : new UnitDefinition(cPtr, false); 689 } 690 691 692/** 693 * Returns the libSBML type code for this SBML object. 694 * <p> 695 * LibSBML attaches an identifying code to every 696 * kind of SBML object. These are known as <em>SBML type codes</em>. In 697 * other languages, the set of type codes is stored in an enumeration; in 698 * the Java language interface for libSBML, the type codes are defined as 699 * static integer constants in the interface class {@link 700 * libsbmlConstants}. The names of the type codes all begin with the 701 * characters <code>SBML_.</code> 702 * <p> 703 * @return the SBML type code for this object, or 704 * {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default). 705 * <p> 706 * @see #getElementName() 707 */ public 708 int getTypeCode() { 709 return libsbmlJNI.Parameter_getTypeCode(swigCPtr, this); 710 } 711 712 713/** 714 * Returns the XML element name of this object, which for {@link Parameter}, is 715 * always <code>'parameter'.</code> 716 * <p> 717 * @return the name of this element, i.e., <code>'parameter'.</code> 718 */ public 719 String getElementName() { 720 return libsbmlJNI.Parameter_getElementName(swigCPtr, this); 721 } 722 723 724/** 725 * Predicate returning <code>true</code> if 726 * all the required attributes for this {@link Parameter} object 727 * have been set. 728 * <p> 729 * @note The required attributes for a {@link Parameter} object are: 730 * <ul> 731 * <li> 'id' (or 'name' in SBML Level 1) 732 * <li> 'value' (required in Level 1, optional otherwise) 733 * </ul> 734 * <p> 735 * @return a boolean value indicating whether all the required 736 * attributes for this object have been defined. 737 */ public 738 boolean hasRequiredAttributes() { 739 return libsbmlJNI.Parameter_hasRequiredAttributes(swigCPtr, this); 740 } 741 742 743/** 744 * Renames all the UnitSIdRef attributes on this element 745 */ public 746 void renameUnitSIdRefs(String oldid, String newid) { 747 libsbmlJNI.Parameter_renameUnitSIdRefs(swigCPtr, this, oldid, newid); 748 } 749 750}