1 //------------------------------------------------------------------------------ 2 // <auto-generated /> 3 // 4 // This file was automatically generated by SWIG (http://www.swig.org). 5 // Version 4.0.2 6 // 7 // Do not make changes to this file unless you know what you are doing--modify 8 // the SWIG interface file instead. 9 //------------------------------------------------------------------------------ 10 11 namespace libsbml { 12 13 using System; 14 using System.Runtime.InteropServices; 15 16 /** 17 * @sbmlpackage{core} 18 * 19 @htmlinclude pkg-marker-core.html A reference to an SBML species in a reaction. 20 * 21 * The Reaction structure provides a way to express which species act as 22 * reactants and which species act as products in a reaction. In a given 23 * reaction, references to those species acting as reactants and/or 24 * products are made using instances of SpeciesReference structures in a 25 * Reaction object's lists of reactants and products. 26 * 27 * A species can occur more than once in the lists of reactants and 28 * products of a given Reaction instance. The effective stoichiometry for 29 * a species in a reaction is the sum of the stoichiometry values given on 30 * the SpeciesReference object in the list of products minus the sum of 31 * stoichiometry values given on the SpeciesReference objects in the list 32 * of reactants. A positive value indicates the species is effectively a 33 * product and a negative value indicates the species is effectively a 34 * reactant. SBML places no restrictions on the effective stoichiometry of 35 * a species in a reaction; for example, it can be zero. In the following 36 * SBML fragment, the two reactions have the same effective stoichiometry 37 * for all their species: 38 * @verbatim 39 <reaction id='x'> 40 <listOfReactants> 41 <speciesReference species='a'/> 42 <speciesReference species='a'/> 43 <speciesReference species='b'/> 44 </listOfReactants> 45 <listOfProducts> 46 <speciesReference species='c'/> 47 <speciesReference species='b'/> 48 </listProducts> 49 </reaction> 50 <reaction id='y'> 51 <listOfReactants> 52 <speciesReference species='a' stoichiometry='2'/> 53 </listOfReactants> 54 <listOfProducts> 55 <speciesReference species='c'/> 56 </listProducts> 57 </reaction> 58 @endverbatim 59 * 60 * The precise structure of SpeciesReference differs between SBML 61 * Level 2 and Level 3. We discuss the two variants in separate 62 * sections below. 63 * 64 * @section spr-l2 SpeciesReference in SBML Level 2 65 * 66 * The mandatory 'species' attribute of SpeciesReference must have as its 67 * value the identifier of an existing species defined in the enclosing 68 * Model. The species is thereby designated as a reactant or product in 69 * the reaction. Which one it is (i.e., reactant or product) is indicated 70 * by whether the SpeciesReference appears in the Reaction's 'reactant' or 71 * 'product' lists. 72 * 73 * Product and reactant stoichiometries can be specified using 74 * <em>either</em> 'stoichiometry' or 'stoichiometryMath' in a 75 * SpeciesReference object. The 'stoichiometry' attribute is of type 76 * double and should contain values greater than @c 0 (false). The 77 * 'stoichiometryMath' element is implemented as an element containing a 78 * MathML expression. These two are mutually exclusive; only one of 79 * 'stoichiometry' or 'stoichiometryMath' should be defined in a given 80 * SpeciesReference instance. When neither the attribute nor the element 81 * is present, the value of 'stoichiometry' in the SpeciesReference 82 * instance defaults to @c 1. 83 * 84 * For maximum interoperability, the 'stoichiometry' attribute should be 85 * used in preference to 'stoichiometryMath' when a species' stoichiometry 86 * is a simple scalar number (integer or decimal). When the stoichiometry 87 * is a rational number, or when it is a more complicated formula, 88 * 'stoichiometryMath' must be used. The MathML expression in 89 * 'stoichiometryMath' may also refer to identifiers of entities in a model 90 * (except reaction identifiers). However, the only species identifiers 91 * that can be used in 'stoichiometryMath' are those referenced in the 92 * Reaction list of reactants, products and modifiers. 93 * 94 * The following is a simple example of a species reference for species 95 * @c X0, with stoichiometry @c 2, in a list of reactants within a reaction 96 * having the identifier @c J1: 97 * @verbatim 98 <model> 99 ... 100 <listOfReactions> 101 <reaction id='J1'> 102 <listOfReactants> 103 <speciesReference species='X0' stoichiometry='2'> 104 </listOfReactants> 105 ... 106 </reaction> 107 ... 108 </listOfReactions> 109 ... 110 </model> 111 @endverbatim 112 * 113 * The following is a more complex example of a species reference for 114 * species X0, with a stoichiometry formula consisting of the parameter 115 * @c x: 116 * @verbatim 117 <model> 118 ... 119 <listOfReactions> 120 <reaction id='J1'> 121 <listOfReactants> 122 <speciesReference species='X0'> 123 <stoichiometryMath> 124 <math xmlns='http://www.w3.org/1998/Math/MathML'> 125 <ci>x</ci> 126 </math> 127 </stoichiometryMath> 128 </speciesReference> 129 </listOfReactants> 130 ... 131 </reaction> 132 ... 133 </listOfReactions> 134 ... 135 </model> 136 @endverbatim 137 * 138 * 139 * @section spr-l3 SpeciesReference in SBML Level 3 140 * 141 * In Level 2's definition of a reaction, the stoichiometry attribute of a 142 * SpeciesReference is actually a combination of two factors, the standard 143 * biochemical stoichiometry and a conversion factor that may be needed to 144 * translate the units of the species quantity to the units of the reaction 145 * rate. Unfortunately, Level 2 offers no direct way of decoupling 146 * these two factors, or for explicitly indicating the units. The only way 147 * to do it in Level 2 is to use the StoichiometryMath object 148 * associated with SpeciesReferences, and to reference SBML Parameter 149 * objects from within the StoichiometryMath formula. This works because 150 * Parameter offers a way to attach units to a numerical value, but the 151 * solution is indirect and awkward for something that should be a simple 152 * matter. Moreover, the question of how to properly encode 153 * stoichiometries in SBML reactions has caused much confusion among 154 * implementors of SBML software. 155 * 156 * SBML Level 3 approaches this problem differently. It (1) extends 157 * the the use of the SpeciesReference identifier to represent the value of 158 * the 'stoichiometry' attribute, (2) makes the 'stoichiometry' attribute 159 * optional, (3) removes StoichiometryMath, and (4) adds a new 'constant' 160 * boolean attribute on SpeciesReference. 161 * 162 * As in Level 2, the 'stoichiometry' attribute is of type 163 * @c double and should contain values greater than zero (@c 0). A 164 * missing 'stoichiometry' implies that the stoichiometry is either 165 * unknown, or to be obtained from an external source, or determined by an 166 * InitialAssignment object or other SBML construct elsewhere in the model. 167 * 168 * A species reference's stoichiometry is set by its 'stoichiometry' 169 * attribute exactly once. If the SpeciesReference object's 'constant' 170 * attribute has the value @c true, then the stoichiometry is fixed and 171 * cannot be changed except by an InitialAssignment object. These two 172 * methods of setting the stoichiometry (i.e., using 'stoichiometry' 173 * directly, or using InitialAssignment) differ in that the 'stoichiometry' 174 * attribute can only be set to a literal floating-point number, whereas 175 * InitialAssignment allows the value to be set using an arbitrary 176 * mathematical expression. (As an example, the approach could be used to 177 * set the stoichiometry to a rational number of the form @em p/@em q, 178 * where @em p and @em q are integers, something that is occasionally 179 * useful in the context of biochemical reaction networks.) If the species 180 * reference's 'constant' attribute has the value @c false, the species 181 * reference's value may be overridden by an InitialAssignment or changed 182 * by AssignmentRule or AlgebraicRule, and in addition, for simulation time 183 * <em>t > 0</em>, it may also be changed by a RateRule or Event 184 * objects. (However, some of these constructs are mutually exclusive; see 185 * the SBML Level 3 Core specifiation for more 186 * details.) It is not an error to define 'stoichiometry' on a species 187 * reference and also redefine the stoichiometry using an 188 * InitialAssignment, but the 'stoichiometry' attribute in that case is 189 * ignored. 190 * 191 * The value of the 'id' attribute of a SpeciesReference can be used as the 192 * content of a <code><ci></code> element in MathML formulas 193 * elsewhere in the model. When the identifier appears in a MathML 194 * <code><ci></code> element, it represents the stoichiometry of the 195 * corresponding species in the reaction where the SpeciesReference object 196 * instance appears. More specifically, it represents the value of the 197 * 'stoichiometry' attribute on the SpeciesReference object. 198 * 199 * In SBML Level 3, the unit of measurement associated with the value of a 200 * species' stoichiometry is always considered to be @c dimensionless. 201 * This has the following implications: 202 * <ul> 203 * 204 * <li> When a species reference's identifier appears in mathematical 205 * formulas elsewhere in the model, the unit associated with that value is 206 * @c dimensionless. 207 * 208 * <li> The units of the 'math' elements of AssignmentRule, 209 * InitialAssignment and EventAssignment objects setting the stoichiometry 210 * of the species reference should be @c dimensionless. 211 * 212 * <li> If a species reference's identifier is the subject of a RateRule, 213 * the unit associated with the RateRule object's value should be 214 * <code>dimensionless</code>/<em>time</em>, where <em>time</em> is the 215 * model-wide unit of time set on the Model object. 216 * 217 * </ul> 218 * 219 * 220 */ 221 222 public class SpeciesReference : SimpleSpeciesReference { 223 private HandleRef swigCPtr; 224 SpeciesReference(IntPtr cPtr, bool cMemoryOwn)225 internal SpeciesReference(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.SpeciesReference_SWIGUpcast(cPtr), cMemoryOwn) 226 { 227 //super(libsbmlPINVOKE.SpeciesReferenceUpcast(cPtr), cMemoryOwn); 228 swigCPtr = new HandleRef(this, cPtr); 229 } 230 getCPtr(SpeciesReference obj)231 internal static HandleRef getCPtr(SpeciesReference obj) 232 { 233 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 234 } 235 getCPtrAndDisown(SpeciesReference obj)236 internal static HandleRef getCPtrAndDisown (SpeciesReference obj) 237 { 238 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 239 240 if (obj != null) 241 { 242 ptr = obj.swigCPtr; 243 obj.swigCMemOwn = false; 244 } 245 246 return ptr; 247 } 248 Dispose(bool disposing)249 protected override void Dispose(bool disposing) { 250 lock(this) { 251 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 252 if (swigCMemOwn) { 253 swigCMemOwn = false; 254 libsbmlPINVOKE.delete_SpeciesReference(swigCPtr); 255 } 256 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 257 } 258 base.Dispose(disposing); 259 } 260 } 261 262 263 /** 264 * Creates a new SpeciesReference using the given SBML @p level and @p version 265 * values. 266 * 267 * @param level a long integer, the SBML Level to assign to this SpeciesReference. 268 * 269 * @param version a long integer, the SBML Version to assign to this 270 * SpeciesReference. 271 * 272 * 273 * @throws SBMLConstructorException 274 * Thrown if the given @p level and @p version combination are invalid 275 * or if this object is incompatible with the given level and version. 276 * 277 * 278 * 279 * 280 * @note Attempting to add an object to an SBMLDocument having a different 281 * combination of SBML Level, Version and XML namespaces than the object 282 * itself will result in an error at the time a caller attempts to make the 283 * addition. A parent object must have compatible Level, Version and XML 284 * namespaces. (Strictly speaking, a parent may also have more XML 285 * namespaces than a child, but the reverse is not permitted.) The 286 * restriction is necessary to ensure that an SBML model has a consistent 287 * overall structure. This requires callers to manage their objects 288 * carefully, but the benefit is increased flexibility in how models can be 289 * created by permitting callers to create objects bottom-up if desired. In 290 * situations where objects are not yet attached to parents (e.g., 291 * SBMLDocument), knowledge of the intented SBML Level and Version help 292 * libSBML determine such things as whether it is valid to assign a 293 * particular value to an attribute. 294 * 295 * 296 */ public SpeciesReference(long level, long version)297 SpeciesReference(long level, long version) : this(libsbmlPINVOKE.new_SpeciesReference__SWIG_0(level, version), true) { 298 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 299 } 300 301 302 /** 303 * Creates a new SpeciesReference using the given SBMLNamespaces object 304 * @p sbmlns. 305 * 306 * @param sbmlns an SBMLNamespaces object. 307 * 308 * 309 * @throws SBMLConstructorException 310 * Thrown if the given @p sbmlns is inconsistent or incompatible 311 * with this object. 312 * 313 * 314 * 315 * 316 * @note Attempting to add an object to an SBMLDocument having a different 317 * combination of SBML Level, Version and XML namespaces than the object 318 * itself will result in an error at the time a caller attempts to make the 319 * addition. A parent object must have compatible Level, Version and XML 320 * namespaces. (Strictly speaking, a parent may also have more XML 321 * namespaces than a child, but the reverse is not permitted.) The 322 * restriction is necessary to ensure that an SBML model has a consistent 323 * overall structure. This requires callers to manage their objects 324 * carefully, but the benefit is increased flexibility in how models can be 325 * created by permitting callers to create objects bottom-up if desired. In 326 * situations where objects are not yet attached to parents (e.g., 327 * SBMLDocument), knowledge of the intented SBML Level and Version help 328 * libSBML determine such things as whether it is valid to assign a 329 * particular value to an attribute. 330 * 331 * 332 */ public SpeciesReference(SBMLNamespaces sbmlns)333 SpeciesReference(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_SpeciesReference__SWIG_1(SBMLNamespaces.getCPtr(sbmlns)), true) { 334 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 335 } 336 337 338 /** 339 * Copy constructor; creates a copy of this SpeciesReference. 340 * 341 * @param orig the SpeciesReference instance to copy. 342 */ public SpeciesReference(SpeciesReference orig)343 SpeciesReference(SpeciesReference orig) : this(libsbmlPINVOKE.new_SpeciesReference__SWIG_2(SpeciesReference.getCPtr(orig)), true) { 344 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 345 } 346 347 348 /** 349 * Creates and returns a deep copy of this SpeciesReference object. 350 * 351 * @return the (deep) copy of this SpeciesReference object. 352 */ public new clone()353 SpeciesReference clone() { 354 SpeciesReference ret 355 = (SpeciesReference) libsbml.DowncastSBase(libsbmlPINVOKE.SpeciesReference_clone(swigCPtr), true); 356 return ret; 357 } 358 359 360 /** 361 * Initializes the fields of this SpeciesReference object to 'typical' 362 * default values. 363 * 364 * The SBML SpeciesReference component has slightly different aspects and 365 * default attribute values in different SBML Levels and Versions. 366 * This method sets the values to certain common defaults, based 367 * mostly on what they are in SBML Level 2. Specifically: 368 * <ul> 369 * <li> Sets attribute 'stoichiometry' to @c 1.0 370 * <li> (Applies to Level 1 models only) Sets attribute 'denominator' to @c 1 371 * </ul> 372 * 373 * @see getDenominator() 374 * @see setDenominator(int value) 375 * @see getStoichiometry() 376 * @see setStoichiometry(double value) 377 * @see getStoichiometryMath() 378 * @see setStoichiometryMath(StoichiometryMath math) 379 */ public initDefaults()380 void initDefaults() { 381 libsbmlPINVOKE.SpeciesReference_initDefaults(swigCPtr); 382 } 383 384 385 /** 386 * Get the value of the 'stoichiometry' attribute. 387 * 388 * In SBML Level 2, product and reactant stoichiometries can be specified 389 * using <em>either</em> 'stoichiometry' or 'stoichiometryMath' in a 390 * SpeciesReference object. The former is to be used when a 391 * stoichiometry is simply a scalar number, while the latter is for 392 * occasions when it needs to be a rational number or it needs to 393 * reference other mathematical expressions. The 'stoichiometry' 394 * attribute is of type @c double and should contain values greater than 395 * zero (@c 0). The 'stoichiometryMath' element is implemented as an 396 * element containing a MathML expression. These two are mutually 397 * exclusive; only one of 'stoichiometry' or 'stoichiometryMath' should 398 * be defined in a given SpeciesReference instance. When neither the 399 * attribute nor the element is present, the value of 'stoichiometry' in 400 * the SpeciesReference instance defaults to @c 1. For maximum 401 * interoperability between different software tools, the 'stoichiometry' 402 * attribute should be used in preference to 'stoichiometryMath' when a 403 * species' stoichiometry is a simple scalar number (integer or 404 * decimal). 405 * 406 * In SBML Level 3, there is no StoichiometryMath, and SpeciesReference 407 * objects have only the 'stoichiometry' attribute. 408 * 409 * @return the value of the (scalar) 'stoichiometry' attribute of this 410 * SpeciesReference. 411 * 412 * @see getStoichiometryMath() 413 */ public getStoichiometry()414 double getStoichiometry() { 415 double ret = libsbmlPINVOKE.SpeciesReference_getStoichiometry(swigCPtr); 416 return ret; 417 } 418 419 420 /** 421 * Get the content of the 'stoichiometryMath' subelement as an ASTNode 422 * tree. 423 * 424 * The 'stoichiometryMath' element exists only in SBML Level 2. There, 425 * product and reactant stoichiometries can be specified using 426 * <em>either</em> 'stoichiometry' or 'stoichiometryMath' in a 427 * SpeciesReference object. The former is to be used when a 428 * stoichiometry is simply a scalar number, while the latter is for 429 * occasions when it needs to be a rational number or it needs to 430 * reference other mathematical expressions. The 'stoichiometry' 431 * attribute is of type @c double and should contain values greater than 432 * zero (@c 0). The 'stoichiometryMath' element is implemented as an 433 * element containing a MathML expression. These two are mutually 434 * exclusive; only one of 'stoichiometry' or 'stoichiometryMath' should 435 * be defined in a given SpeciesReference instance. When neither the 436 * attribute nor the element is present, the value of 'stoichiometry' in 437 * the SpeciesReference instance defaults to @c 1. For maximum 438 * interoperability between different software tools, the 'stoichiometry' 439 * attribute should be used in preference to 'stoichiometryMath' when a 440 * species' stoichiometry is a simple scalar number (integer or decimal). 441 * 442 * @return the content of the 'stoichiometryMath' subelement of this 443 * SpeciesReference. 444 */ public getStoichiometryMath()445 StoichiometryMath getStoichiometryMath() { 446 global::System.IntPtr cPtr = libsbmlPINVOKE.SpeciesReference_getStoichiometryMath__SWIG_0(swigCPtr); 447 StoichiometryMath ret = (cPtr == global::System.IntPtr.Zero) ? null : new StoichiometryMath(cPtr, false); 448 return ret; 449 } 450 451 452 /** 453 * Get the value of the 'denominator' attribute, for the case of a 454 * rational-numbered stoichiometry or a model in SBML Level 1. 455 * 456 * The 'denominator' attribute is only actually written out in the case 457 * of an SBML Level 1 model. In SBML Level 2, rational-number 458 * stoichiometries are written as MathML elements in the 459 * 'stoichiometryMath' subelement. However, as a convenience to users, 460 * libSBML allows the creation and manipulation of rational-number 461 * stoichiometries by supplying the numerator and denominator directly 462 * rather than having to manually create an ASTNode object. LibSBML 463 * will write out the appropriate constructs (either a combination of 464 * 'stoichiometry' and 'denominator' in the case of SBML Level 1, or a 465 * 'stoichiometryMath' subelement in the case of SBML Level 2). 466 * However, as the 'stoichiometryMath' subelement was removed in SBML 467 * Level 3, automatic translation of the 'denominator' 468 * attribute is no longer supported for that level. 469 * 470 * @return the value of the 'denominator' attribute of this 471 * SpeciesReference. 472 */ public getDenominator()473 int getDenominator() { 474 int ret = libsbmlPINVOKE.SpeciesReference_getDenominator(swigCPtr); 475 return ret; 476 } 477 478 479 /** 480 * Get the value of the 'constant' attribute. 481 * 482 * @return the value of the 'constant' attribute of this 483 * SpeciesReference. 484 */ public getConstant()485 bool getConstant() { 486 bool ret = libsbmlPINVOKE.SpeciesReference_getConstant(swigCPtr); 487 return ret; 488 } 489 490 491 /** 492 * Predicate returning @c true if this 493 * SpeciesReference's 'stoichiometryMath' subelement is set 494 * 495 * @return @c true if the 'stoichiometryMath' subelement of this 496 * SpeciesReference is set, @c false otherwise. 497 */ public isSetStoichiometryMath()498 bool isSetStoichiometryMath() { 499 bool ret = libsbmlPINVOKE.SpeciesReference_isSetStoichiometryMath(swigCPtr); 500 return ret; 501 } 502 503 504 /** 505 * Predicate returning @c true if this 506 * SpeciesReference's 'constant' attribute is set 507 * 508 * @return @c true if the 'constant' attribute of this 509 * SpeciesReference is set, @c false otherwise. 510 */ public isSetConstant()511 bool isSetConstant() { 512 bool ret = libsbmlPINVOKE.SpeciesReference_isSetConstant(swigCPtr); 513 return ret; 514 } 515 516 517 /** 518 * Predicate returning @c true if this 519 * SpeciesReference's 'stoichiometry' attribute is set. 520 * 521 * @return @c true if the 'stoichiometry' attribute of this 522 * SpeciesReference is set, @c false otherwise. 523 */ public isSetStoichiometry()524 bool isSetStoichiometry() { 525 bool ret = libsbmlPINVOKE.SpeciesReference_isSetStoichiometry(swigCPtr); 526 return ret; 527 } 528 529 530 /** 531 * Sets the value of the 'stoichiometry' attribute of this 532 * SpeciesReference. 533 * 534 * In SBML Level 2, product and reactant stoichiometries can be specified 535 * using <em>either</em> 'stoichiometry' or 'stoichiometryMath' in a 536 * SpeciesReference object. The former is to be used when a 537 * stoichiometry is simply a scalar number, while the latter is for 538 * occasions when it needs to be a rational number or it needs to 539 * reference other mathematical expressions. The 'stoichiometry' 540 * attribute is of type @c double and should contain values greater than 541 * zero (@c 0). The 'stoichiometryMath' element is implemented as an 542 * element containing a MathML expression. These two are mutually 543 * exclusive; only one of 'stoichiometry' or 'stoichiometryMath' should 544 * be defined in a given SpeciesReference instance. When neither the 545 * attribute nor the element is present, the value of 'stoichiometry' in 546 * the SpeciesReference instance defaults to @c 1. For maximum 547 * interoperability between different software tools, the 'stoichiometry' 548 * attribute should be used in preference to 'stoichiometryMath' when a 549 * species' stoichiometry is a simple scalar number (integer or 550 * decimal). 551 * 552 * In SBML Level 3, there is no StoichiometryMath, and SpeciesReference 553 * objects have only the 'stoichiometry' attribute. 554 * 555 * @param value the new value of the 'stoichiometry' attribute. 556 * 557 * @note In SBML Level 2, the 'stoichiometryMath' subelement of this 558 * SpeciesReference object will be unset because the 'stoichiometry' 559 * attribute and the stoichiometryMath' subelement are mutually 560 * exclusive. 561 * 562 * 563 * @return integer value indicating success/failure of the 564 * function. @if clike The value is drawn from the 565 * enumeration #OperationReturnValues_t. @endif The possible values 566 * returned by this function are: 567 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 568 */ public setStoichiometry(double value)569 int setStoichiometry(double value) { 570 int ret = libsbmlPINVOKE.SpeciesReference_setStoichiometry(swigCPtr, value); 571 return ret; 572 } 573 574 575 /** 576 * Sets the 'stoichiometryMath' subelement of this SpeciesReference. 577 * 578 * The Abstract Syntax Tree in @p math is copied. 579 * 580 * In SBML Level 2, product and reactant stoichiometries can be specified 581 * using <em>either</em> 'stoichiometry' or 'stoichiometryMath' in a 582 * SpeciesReference object. The former is to be used when a 583 * stoichiometry is simply a scalar number, while the latter is for 584 * occasions when it needs to be a rational number or it needs to 585 * reference other mathematical expressions. The 'stoichiometry' 586 * attribute is of type @c double and should contain values greater than 587 * zero (@c 0). The 'stoichiometryMath' element is implemented as an 588 * element containing a MathML expression. These two are mutually 589 * exclusive; only one of 'stoichiometry' or 'stoichiometryMath' should 590 * be defined in a given SpeciesReference instance. When neither the 591 * attribute nor the element is present, the value of 'stoichiometry' in 592 * the SpeciesReference instance defaults to @c 1. For maximum 593 * interoperability between different software tools, the 'stoichiometry' 594 * attribute should be used in preference to 'stoichiometryMath' when a 595 * species' stoichiometry is a simple scalar number (integer or 596 * decimal). 597 * 598 * In SBML Level 3, there is no StoichiometryMath, and SpeciesReference 599 * objects have only the 'stoichiometry' attribute. 600 * 601 * @param math the StoichiometryMath expression that is to be copied as the 602 * content of the 'stoichiometryMath' subelement. 603 * 604 * @note In SBML Level 2, the 'stoichiometry' attribute of this 605 * SpeciesReference object will be unset (isSetStoichiometry() will 606 * return @c false although getStoichiometry() will return @c 1.0) if the 607 * given math is not null because the 'stoichiometry' attribute and the 608 * stoichiometryMath' subelement are mutually exclusive. 609 * 610 * 611 * @return integer value indicating success/failure of the 612 * function. @if clike The value is drawn from the 613 * enumeration #OperationReturnValues_t. @endif The possible values 614 * returned by this function are: 615 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 616 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 617 * @li @link libsbml#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink 618 * @li @link libsbml#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink 619 */ public setStoichiometryMath(StoichiometryMath math)620 int setStoichiometryMath(StoichiometryMath math) { 621 int ret = libsbmlPINVOKE.SpeciesReference_setStoichiometryMath(swigCPtr, StoichiometryMath.getCPtr(math)); 622 return ret; 623 } 624 625 626 /** 627 * Set the value of the 'denominator' attribute, for the case of a 628 * rational-numbered stoichiometry or a model in SBML Level 1. 629 * 630 * The 'denominator' attribute is only actually written out in the case 631 * of an SBML Level 1 model. In SBML Level 2, rational-number 632 * stoichiometries are written as MathML elements in the 633 * 'stoichiometryMath' subelement. However, as a convenience to users, 634 * libSBML allows the creation and manipulation of rational-number 635 * stoichiometries by supplying the numerator and denominator directly 636 * rather than having to manually create an ASTNode object. LibSBML 637 * will write out the appropriate constructs (either a combination of 638 * 'stoichiometry' and 'denominator' in the case of SBML Level 1, or 639 * a 'stoichiometryMath' subelement in the case of SBML Level 2). 640 * However, as the 'stoichiometryMath' subelement was removed in SBML 641 * Level 3, automatic translation of the 'denominator' 642 * attribute is no longer supported for that level. 643 * 644 * @param value the scalar value. 645 * 646 * 647 * @return integer value indicating success/failure of the 648 * function. @if clike The value is drawn from the 649 * enumeration #OperationReturnValues_t. @endif The possible values 650 * returned by this function are: 651 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 652 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 653 */ public setDenominator(int value)654 int setDenominator(int value) { 655 int ret = libsbmlPINVOKE.SpeciesReference_setDenominator(swigCPtr, value); 656 return ret; 657 } 658 659 660 /** 661 * Sets the 'constant' attribute of this SpeciesReference to the given boolean 662 * @p flag. 663 * 664 * @param flag a boolean, the value for the 'constant' attribute of this 665 * SpeciesReference instance. 666 * 667 * 668 * @return integer value indicating success/failure of the 669 * function. @if clike The value is drawn from the 670 * enumeration #OperationReturnValues_t. @endif The possible values 671 * returned by this function are: 672 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 673 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 674 */ public setConstant(bool flag)675 int setConstant(bool flag) { 676 int ret = libsbmlPINVOKE.SpeciesReference_setConstant(swigCPtr, flag); 677 return ret; 678 } 679 680 681 /** 682 * Unsets the 'stoichiometryMath' subelement of this SpeciesReference. 683 * 684 * 685 * @return integer value indicating success/failure of the 686 * function. @if clike The value is drawn from the 687 * enumeration #OperationReturnValues_t. @endif The possible values 688 * returned by this function are: 689 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 690 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 691 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 692 * 693 * In SBML Level 2, product and reactant stoichiometries can be specified 694 * using <em>either</em> 'stoichiometry' or 'stoichiometryMath' in a 695 * SpeciesReference object. The former is to be used when a 696 * stoichiometry is simply a scalar number, while the latter is for 697 * occasions when it needs to be a rational number or it needs to 698 * reference other mathematical expressions. The 'stoichiometry' 699 * attribute is of type @c double and should contain values greater than 700 * zero (@c 0). The 'stoichiometryMath' element is implemented as an 701 * element containing a MathML expression. These two are mutually 702 * exclusive; only one of 'stoichiometry' or 'stoichiometryMath' should 703 * be defined in a given SpeciesReference instance. When neither the 704 * attribute nor the element is present, the value of 'stoichiometry' in 705 * the SpeciesReference instance defaults to @c 1. For maximum 706 * interoperability between different software tools, the 'stoichiometry' 707 * attribute should be used in preference to 'stoichiometryMath' when a 708 * species' stoichiometry is a simple scalar number (integer or 709 * decimal). 710 * 711 * In SBML Level 3, there is no StoichiometryMath, and SpeciesReference 712 * objects have only the 'stoichiometry' attribute. 713 * 714 * @note In SBML Level 2, the 'stoichiometry' attribute of this 715 * SpeciesReference object will be reset to a default value (@c 1.0) if 716 * the 'stoichiometry' attribute has not been set. 717 */ public unsetStoichiometryMath()718 int unsetStoichiometryMath() { 719 int ret = libsbmlPINVOKE.SpeciesReference_unsetStoichiometryMath(swigCPtr); 720 return ret; 721 } 722 723 724 /** 725 * Unsets the 'stoichiometry' attribute of this SpeciesReference. 726 * 727 * 728 * @return integer value indicating success/failure of the 729 * function. @if clike The value is drawn from the 730 * enumeration #OperationReturnValues_t. @endif The possible values 731 * returned by this function are: 732 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 733 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 734 * 735 * @note In SBML Level 1, the 'stoichiometry' attribute of this 736 * SpeciesReference object will be just reset to a default value (@c 1.0) 737 * and isSetStoichiometry() will still return @c true. In SBML 738 * Level 2, the 'stoichiometry' attribute of this object will be 739 * unset (which will result in isSetStoichiometry() returning @c false, 740 * although getStoichiometry() will return @c 1.0) if the 741 * 'stoichiometryMath' subelement is set, otherwise the attribute 742 * will be just reset to the default value (@c 1.0) (and 743 * isSetStoichiometry() will still return @c true). In SBML 744 * Level 3, the 'stoichiometry' attribute of this object will be set 745 * to @c NaN and isSetStoichiometry() will return @c false. 746 */ public unsetStoichiometry()747 int unsetStoichiometry() { 748 int ret = libsbmlPINVOKE.SpeciesReference_unsetStoichiometry(swigCPtr); 749 return ret; 750 } 751 752 753 /** 754 * Unsets the 'constant' attribute of this SpeciesReference. 755 * 756 * 757 * @return integer value indicating success/failure of the 758 * function. @if clike The value is drawn from the 759 * enumeration #OperationReturnValues_t. @endif The possible values 760 * returned by this function are: 761 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 762 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 763 */ public unsetConstant()764 int unsetConstant() { 765 int ret = libsbmlPINVOKE.SpeciesReference_unsetConstant(swigCPtr); 766 return ret; 767 } 768 769 770 /** 771 * Creates a new, empty StoichiometryMath object, adds it to this 772 * SpeciesReference, and returns it. 773 * 774 * @return the newly created StoichiometryMath object instance. 775 * 776 * @note This function has no effect on SBML Level 1 or Level 3 777 * SpeciesReference objects, neither of which have 778 * StoichiometryMath children. 779 * 780 * @see Reaction::addReactant(SpeciesReference sr) 781 * @see Reaction::addProduct(SpeciesReference sr) 782 */ public createStoichiometryMath()783 StoichiometryMath createStoichiometryMath() { 784 global::System.IntPtr cPtr = libsbmlPINVOKE.SpeciesReference_createStoichiometryMath(swigCPtr); 785 StoichiometryMath ret = (cPtr == global::System.IntPtr.Zero) ? null : new StoichiometryMath(cPtr, false); 786 return ret; 787 } 788 789 790 /** 791 * Sets the value of the 'annotation' subelement of this SBML object to a 792 * copy of @p annotation. 793 * 794 * Any existing content of the 'annotation' subelement is discarded. 795 * Unless you have taken steps to first copy and reconstitute any 796 * existing annotations into the @p annotation that is about to be 797 * assigned, it is likely that performing such wholesale replacement is 798 * unfriendly towards other software applications whose annotations are 799 * discarded. An alternative may be to use appendAnnotation(). 800 * 801 * @param annotation an XML structure that is to be used as the content 802 * of the 'annotation' subelement of this object. 803 * 804 * 805 * @return integer value indicating success/failure of the 806 * function. @if clike The value is drawn from the 807 * enumeration #OperationReturnValues_t. @endif This particular 808 * function only does one thing irrespective of user input or 809 * object state, and thus will only return a single value: 810 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 811 * 812 * @see appendAnnotation(XMLNode annotation) 813 * @see appendAnnotation(string annotation) 814 */ public new setAnnotation(XMLNode annotation)815 int setAnnotation(XMLNode annotation) { 816 int ret = libsbmlPINVOKE.SpeciesReference_setAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation)); 817 return ret; 818 } 819 820 821 /** 822 * Sets the value of the 'annotation' subelement of this SBML object to a 823 * copy of @p annotation. 824 * 825 * Any existing content of the 'annotation' subelement is discarded. 826 * Unless you have taken steps to first copy and reconstitute any 827 * existing annotations into the @p annotation that is about to be 828 * assigned, it is likely that performing such wholesale replacement is 829 * unfriendly towards other software applications whose annotations are 830 * discarded. An alternative may be to use appendAnnotation(). 831 * 832 * @param annotation an XML string that is to be used as the content 833 * of the 'annotation' subelement of this object. 834 * 835 * 836 * @return integer value indicating success/failure of the 837 * function. @if clike The value is drawn from the 838 * enumeration #OperationReturnValues_t. @endif The possible values 839 * returned by this function are: 840 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 841 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 842 * 843 * @see appendAnnotation(XMLNode annotation) 844 * @see appendAnnotation(string annotation) 845 */ public new setAnnotation(string annotation)846 int setAnnotation(string annotation) { 847 int ret = libsbmlPINVOKE.SpeciesReference_setAnnotation__SWIG_1(swigCPtr, annotation); 848 return ret; 849 } 850 851 852 /** 853 * Appends annotation content to any existing content in the 'annotation' 854 * subelement of this object. 855 * 856 * The content in @p annotation is copied. Unlike 857 * SpeciesReference::setAnnotation(@if java String@endif), 858 * this method allows other annotations to be preserved when an application 859 * adds its own data. 860 * 861 * @param annotation an XML structure that is to be copied and appended 862 * to the content of the 'annotation' subelement of this object. 863 * 864 * 865 * @return integer value indicating success/failure of the 866 * function. @if clike The value is drawn from the 867 * enumeration #OperationReturnValues_t. @endif The possible values 868 * returned by this function are: 869 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 870 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 871 * 872 * @see setAnnotation(string annotation) 873 * @see setAnnotation(XMLNode annotation) 874 */ public new appendAnnotation(XMLNode annotation)875 int appendAnnotation(XMLNode annotation) { 876 int ret = libsbmlPINVOKE.SpeciesReference_appendAnnotation__SWIG_0(swigCPtr, XMLNode.getCPtr(annotation)); 877 return ret; 878 } 879 880 881 /** 882 * Appends annotation content to any existing content in the 'annotation' 883 * subelement of this object. 884 * 885 * The content in @p annotation is copied. Unlike 886 * SpeciesReference::setAnnotation(@if java String@endif), this 887 * method allows other annotations to be preserved when an application 888 * adds its own data. 889 * 890 * @param annotation an XML string that is to be copied and appended 891 * to the content of the 'annotation' subelement of this object. 892 * 893 * 894 * @return integer value indicating success/failure of the 895 * function. @if clike The value is drawn from the 896 * enumeration #OperationReturnValues_t. @endif The possible values 897 * returned by this function are: 898 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 899 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 900 * 901 * @see setAnnotation(string annotation) 902 * @see setAnnotation(XMLNode annotation) 903 */ public new appendAnnotation(string annotation)904 int appendAnnotation(string annotation) { 905 int ret = libsbmlPINVOKE.SpeciesReference_appendAnnotation__SWIG_1(swigCPtr, annotation); 906 return ret; 907 } 908 909 910 /** 911 * Returns the libSBML type code for this %SBML object. 912 * 913 * 914 * 915 * LibSBML attaches an identifying code to every kind of SBML object. These 916 * are integer constants known as <em>SBML type codes</em>. The names of all 917 * the codes begin with the characters <code>SBML_</code>. 918 * @if clike The set of possible type codes for core elements is defined in 919 * the enumeration #SBMLTypeCode_t, and in addition, libSBML plug-ins for 920 * SBML Level 3 packages define their own extra enumerations of type 921 * codes (e.g., #SBMLLayoutTypeCode_t for the Level 3 Layout 922 * package).@endif@if java In the Java language interface for libSBML, the 923 * type codes are defined as static integer constants in the interface class 924 * {@link libsbmlConstants}. @endif@if python In the Python language 925 * interface for libSBML, the type codes are defined as static integer 926 * constants in the interface class @link libsbml@endlink.@endif@if csharp In 927 * the C# language interface for libSBML, the type codes are defined as 928 * static integer constants in the interface class 929 * @link libsbmlcs.libsbml@endlink.@endif Note that different Level 3 930 * package plug-ins may use overlapping type codes; to identify the package 931 * to which a given object belongs, call the 932 * <code>@if conly SBase_getPackageName() 933 * @else SBase::getPackageName() 934 * @endif</code> 935 * method on the object. 936 * 937 * The exception to this is lists: all SBML-style list elements have the type 938 * @link libsbml#SBML_LIST_OF SBML_LIST_OF@endlink, regardless of what package they 939 * are from. 940 * 941 * 942 * 943 * @return the SBML type code for this object: 944 * @link libsbml#SBML_SPECIES_REFERENCE SBML_SPECIES_REFERENCE@endlink (default). 945 * 946 * @see getElementName() 947 * @see getPackageName() 948 */ public new getTypeCode()949 int getTypeCode() { 950 int ret = libsbmlPINVOKE.SpeciesReference_getTypeCode(swigCPtr); 951 return ret; 952 } 953 954 955 /** 956 * Returns the XML element name of this object, which for 957 * SpeciesReference, is always @c 'speciesReference'. 958 * 959 * @return the name of this element, i.e., @c 'speciesReference'. 960 */ public new getElementName()961 string getElementName() { 962 string ret = libsbmlPINVOKE.SpeciesReference_getElementName(swigCPtr); 963 return ret; 964 } 965 966 967 /** 968 * Predicate returning @c true if 969 * all the required attributes for this SpeciesReference object 970 * have been set. 971 * 972 * The required attributes for a SpeciesReference object are: 973 * @li 'species' 974 * @li 'constant' (only available SBML Level 3) 975 * 976 * @return @c true if the required attributes have been set, @c false 977 * otherwise. 978 */ public new hasRequiredAttributes()979 bool hasRequiredAttributes() { 980 bool ret = libsbmlPINVOKE.SpeciesReference_hasRequiredAttributes(swigCPtr); 981 return ret; 982 } 983 984 } 985 986 } 987