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 Parent class for SBML <em>rules</em> in libSBML. 20 * 21 * In SBML, @em rules provide additional ways to define the values of 22 * variables in a model, their relationships, and the dynamical behaviors 23 * of those variables. They enable encoding relationships that cannot be 24 * expressed using Reaction nor InitialAssignment objects alone. 25 * 26 * The libSBML implementation of rules mirrors the SBML Level 3 27 * definition (which is in turn is very similar to the 28 * Level 2 Version 4 definition), with Rule being the parent 29 * class of three subclasses as explained below. The Rule class itself 30 * cannot be instantiated by user programs and has no constructor; only the 31 * subclasses AssignmentRule, AlgebraicRule and RateRule can be 32 * instantiated directly. 33 * 34 * 35 * @section rules-general General summary of SBML rules 36 * 37 * In SBML Level 3 as well as Level 2, rules are separated into three 38 * subclasses for the benefit of model analysis software. The three 39 * subclasses are based on the following three different possible functional 40 * forms (where <em>x</em> is a variable, <em>f</em> is some arbitrary 41 * function returning a numerical result, <b><em>V</em></b> is a vector of 42 * variables that does not include <em>x</em>, and <b><em>W</em></b> is a 43 * vector of variables that may include <em>x</em>): 44 * 45 * <table border='0' cellpadding='0' class='centered' style='font-size: small'> 46 * <tr><td width='120px'><em>Algebraic:</em></td><td width='250px'>left-hand side is zero</td><td><em>0 = f(<b>W</b>)</em></td></tr> 47 * <tr><td><em>Assignment:</em></td><td>left-hand side is a scalar:</td><td><em>x = f(<b>V</b>)</em></td></tr> 48 * <tr><td><em>Rate:</em></td><td>left-hand side is a rate-of-change:</td><td><em>dx/dt = f(<b>W</b>)</em></td></tr> 49 * </table> 50 * 51 * In their general form given above, there is little to distinguish 52 * between <em>assignment</em> and <em>algebraic</em> rules. They are treated as 53 * separate cases for the following reasons: 54 * 55 * @li <em>Assignment</em> rules can simply be evaluated to calculate 56 * intermediate values for use in numerical methods. They are statements 57 * of equality that hold at all times. (For assignments that are only 58 * performed once, see InitialAssignment.) 59 60 * @li SBML needs to place restrictions on assignment rules, for example 61 * the restriction that assignment rules cannot contain algebraic loops. 62 * 63 * @li Some simulators do not contain numerical solvers capable of solving 64 * unconstrained algebraic equations, and providing more direct forms such 65 * as assignment rules may enable those simulators to process models they 66 * could not process if the same assignments were put in the form of 67 * general algebraic equations; 68 * 69 * @li Those simulators that <em>can</em> solve these algebraic equations make a 70 * distinction between the different categories listed above; and 71 * 72 * @li Some specialized numerical analyses of models may only be applicable 73 * to models that do not contain <em>algebraic</em> rules. 74 * 75 * The approach taken to covering these cases in SBML is to define an 76 * abstract Rule structure containing a subelement, 'math', to hold the 77 * right-hand side expression, then to derive subtypes of Rule that add 78 * attributes to distinguish the cases of algebraic, assignment and rate 79 * rules. The 'math' subelement must contain a MathML expression defining the 80 * mathematical formula of the rule. This MathML formula must return a 81 * numerical value. The formula can be an arbitrary expression referencing 82 * the variables and other entities in an SBML model. 83 * 84 * Each of the three subclasses of Rule (AssignmentRule, AlgebraicRule, 85 * RateRule) inherit the the 'math' subelement and other fields from SBase. 86 * The AssignmentRule and RateRule classes add an additional attribute, 87 * 'variable'. See the definitions of AssignmentRule, AlgebraicRule and 88 * RateRule for details about the structure and interpretation of each one. 89 * 90 * @section rules-restrictions Additional restrictions on SBML rules 91 * 92 * An important design goal of SBML rule semantics is to ensure that a 93 * model's simulation and analysis results will not be dependent on when or 94 * how often rules are evaluated. To achieve this, SBML needs to place two 95 * restrictions on rule use. The first concerns algebraic loops in the system 96 * of assignments in a model, and the second concerns overdetermined systems. 97 * 98 * @subsection rules-no-loops A model must not contain algebraic loops 99 * 100 * The combined set of InitialAssignment, AssignmentRule and KineticLaw 101 * objects in a model constitute a set of assignment statements that should be 102 * considered as a whole. (A KineticLaw object is counted as an assignment 103 * because it assigns a value to the symbol contained in the 'id' attribute of 104 * the Reaction object in which it is defined.) This combined set of 105 * assignment statements must not contain algebraic loops---dependency 106 * chains between these statements must terminate. To put this more formally, 107 * consider a directed graph in which nodes are assignment statements and 108 * directed arcs exist for each occurrence of an SBML species, compartment or 109 * parameter symbol in an assignment statement's 'math' subelement. Let the 110 * directed arcs point from the statement assigning the symbol to the 111 * statements that contain the symbol in their 'math' subelement expressions. 112 * This graph must be acyclic. 113 * 114 * Similarly, the combined set of RateRule and Reaction objects constitute 115 * a set of definitions for the rates of change of various model entities 116 * (namely, the objects identified by the values of the 'variable' attributes 117 * of the RateRule objects, and the 'species' attributes of the SpeciesReference 118 * objects in each Reaction). In SBML Level 3 Version 2, these rates 119 * of change may be referenced directly 120 * using the <em>rateOf</em> csymbol, but may not thereby contain algebraic 121 * loops---dependency chains between these statements must terminate. More 122 * formally, consider a directed graph in which the nodes are the definitions 123 * of different variables' rates of change, and directed arcs exist for each 124 * occurrence of a variable referenced by a <em>rateOf</em> csymbol from any 125 * RateRule or KineticLaw object in the model. Let the directed arcs point 126 * from the variable referenced by the <em>rateOf</em> csymbol (call it 127 * <em>x</em>) to the variable(s) determined by the 'math' expression in which 128 * <em>x</em> appears. This graph must be acyclic. 129 * 130 * SBML does not specify when or how often rules should be evaluated. 131 * Eliminating algebraic loops ensures that assignment statements can be 132 * evaluated any number of times without the result of those evaluations 133 * changing. As an example, consider the set of equations <em>x = x + 1</em>, 134 * <em>y = z + 200</em> and <em>z = y + 100</em>. If this set of equations 135 * were interpreted as a set of assignment statements, it would be invalid 136 * because the rule for <em>x</em> refers to <em>x</em> (exhibiting one type 137 * of loop), and the rule for <em>y</em> refers to <em>z</em> while the rule 138 * for <em>z</em> refers back to <em>y</em> (exhibiting another type of loop). 139 * Conversely, the following set of equations would constitute a valid set of 140 * assignment statements: <em>x = 10</em>, <em>y = z + 200</em>, and <em>z = x 141 * + 100</em>. 142 * 143 * @subsection rules-not-overdetermined A model must not be overdetermined 144 * 145 * An SBML model must not be overdetermined; that is, a model must not 146 * define more equations than there are unknowns in a model. A valid SBML model 147 * that does not contain AlgebraicRule structures cannot be overdetermined. 148 * 149 * LibSBML implements the static analysis procedure described in 150 * Appendix B of the SBML Level 3 151 * specification for assessing whether a model is overdetermined. 152 * 153 * (In summary, assessing whether a given continuous, deterministic, 154 * mathematical model is overdetermined does not require dynamic analysis; it 155 * can be done by analyzing the system of equations created from the model. 156 * One approach is to construct a bipartite graph in which one set of vertices 157 * represents the variables and the other the set of vertices represents the 158 * equations. Place edges between vertices such that variables in the system 159 * are linked to the equations that determine them. For algebraic equations, 160 * there will be edges between the equation and each variable occurring in the 161 * equation. For ordinary differential equations (such as those defined by 162 * rate rules or implied by the reaction rate definitions), there will be a 163 * single edge between the equation and the variable determined by that 164 * differential equation. A mathematical model is overdetermined if the 165 * maximal matchings of the bipartite graph contain disconnected vertexes 166 * representing equations. If one maximal matching has this property, then 167 * all the maximal matchings will have this property; i.e., it is only 168 * necessary to find one maximal matching.) 169 * 170 * @section RuleType_t Rule types for SBML Level 1 171 * 172 * SBML Level 1 uses a different scheme than SBML Level 2 and Level 3 for 173 * distinguishing rules; specifically, it uses an attribute whose value is 174 * drawn from an enumeration of 3 values. LibSBML supports this using methods 175 * that work @if clike a libSBML enumeration type, 176 * @link Rule::RuleType_t RuleType_t@endlink, whose values 177 * are @else with the enumeration values @endif listed below. 178 * 179 * @li @link libsbml#RULE_TYPE_RATE RULE_TYPE_RATE@endlink: Indicates 180 * the rule is a 'rate' rule. 181 * @li @link libsbml#RULE_TYPE_SCALAR RULE_TYPE_SCALAR@endlink: 182 * Indicates the rule is a 'scalar' rule. 183 * @li @link libsbml#RULE_TYPE_INVALID RULE_TYPE_INVALID@endlink: 184 * Indicates the rule type is unknown or not yet set. 185 * 186 * 187 * 188 * 189 * 190 */ 191 192 public class Rule : SBase { 193 private HandleRef swigCPtr; 194 Rule(IntPtr cPtr, bool cMemoryOwn)195 internal Rule(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.Rule_SWIGUpcast(cPtr), cMemoryOwn) 196 { 197 //super(libsbmlPINVOKE.RuleUpcast(cPtr), cMemoryOwn); 198 swigCPtr = new HandleRef(this, cPtr); 199 } 200 getCPtr(Rule obj)201 internal static HandleRef getCPtr(Rule obj) 202 { 203 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 204 } 205 getCPtrAndDisown(Rule obj)206 internal static HandleRef getCPtrAndDisown (Rule obj) 207 { 208 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 209 210 if (obj != null) 211 { 212 ptr = obj.swigCPtr; 213 obj.swigCMemOwn = false; 214 } 215 216 return ptr; 217 } 218 Dispose(bool disposing)219 protected override void Dispose(bool disposing) { 220 lock(this) { 221 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 222 if (swigCMemOwn) { 223 swigCMemOwn = false; 224 libsbmlPINVOKE.delete_Rule(swigCPtr); 225 } 226 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 227 } 228 base.Dispose(disposing); 229 } 230 } 231 232 233 /** 234 * Copy constructor; creates a copy of this Rule. 235 * 236 * @param orig the object to copy. 237 */ public Rule(Rule orig)238 Rule(Rule orig) : this(libsbmlPINVOKE.new_Rule(Rule.getCPtr(orig)), true) { 239 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 240 } 241 242 243 /** 244 * Creates and returns a deep copy of this Rule object. 245 * 246 * @return the (deep) copy of this Rule object. 247 */ public new clone()248 Rule clone() { 249 Rule ret = (Rule) libsbml.DowncastSBase(libsbmlPINVOKE.Rule_clone(swigCPtr), true); 250 return ret; 251 } 252 253 254 /** 255 * Returns the mathematical expression of this Rule in text-string form. 256 * 257 * The text string is produced by @sbmlfunction{formulaToString, ASTNode}; please consult 258 * the documentation for that function to find out more about the format 259 * of the text-string formula. 260 * 261 * @return the formula text string for this Rule. 262 * 263 * @note The attribute 'formula' is specific to SBML Level 1; in 264 * higher Levels of SBML, it has been replaced with a subelement named 265 * 'math'. However, libSBML provides a unified interface to the 266 * underlying math expression and this method can be used for models 267 * of all Levels of SBML. 268 * 269 * @see getMath() 270 * @see @sbmlfunction{formulaToL3String, ASTNode} 271 */ public getFormula()272 string getFormula() { 273 string ret = libsbmlPINVOKE.Rule_getFormula(swigCPtr); 274 return ret; 275 } 276 277 278 /** 279 * Get the mathematical formula of this Rule as an ASTNode tree. 280 * 281 * @return an ASTNode, the value of the 'math' subelement of this Rule, 282 * or @c null if the math is not set. 283 * 284 * @note The subelement 'math' is present in SBML Levels 2 285 * and 3. In SBML Level 1, the equivalent construct is the 286 * attribute named 'formula'. LibSBML provides a unified interface to 287 * the underlying math expression and this method can be used for models 288 * of all Levels of SBML. 289 * 290 * @see getFormula() 291 */ public new getMath()292 ASTNode getMath() { 293 global::System.IntPtr cPtr = libsbmlPINVOKE.Rule_getMath(swigCPtr); 294 ASTNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new ASTNode(cPtr, false); 295 return ret; 296 } 297 298 299 /** 300 * Get the value of the 'variable' attribute of this Rule object. 301 * 302 * 303 * 304 * In SBML Level 1, the different rule types each have a different 305 * name for the attribute holding the reference to the object constituting 306 * the left-hand side of the rule. (E.g., for SBML Level 1's 307 * SpeciesConcentrationRule the attribute is 'species', for 308 * CompartmentVolumeRule it is 'compartment', etc.) In SBML Levels 2 309 * and 3, the only two types of Rule objects with a left-hand side 310 * object reference are AssignmentRule and RateRule, and both of them use the 311 * same name for attribute: 'variable'. In order to make it easier for 312 * application developers to work with all Levels of SBML, libSBML uses a 313 * uniform name for all such attributes, and it is 'variable', regardless of 314 * whether Level 1 rules or Level 2–3 rules are being used. 315 * 316 * 317 * The 'variable' attribute of a Rule indicates the element which 318 * the results of the 'math' are to be applied. An AlgebraicRule has 319 * no 'variable', and will always return an empty string. 320 * 321 * @return the identifier string stored as the 'variable' attribute value 322 * in this Rule, or @c null if this object is an AlgebraicRule object, or if 323 * the attribute is unset. 324 */ public getVariable()325 string getVariable() { 326 string ret = libsbmlPINVOKE.Rule_getVariable(swigCPtr); 327 return ret; 328 } 329 330 331 /** 332 * Returns the units for the 333 * mathematical formula of this Rule. 334 * 335 * @return the identifier of the units for the expression of this Rule. 336 * 337 * @note The attribute 'units' exists on SBML Level 1 ParameterRule 338 * objects only. It is not present in SBML Levels 2 and 3. 339 */ public getUnits()340 string getUnits() { 341 string ret = libsbmlPINVOKE.Rule_getUnits(swigCPtr); 342 return ret; 343 } 344 345 346 /** 347 * Predicate returning @c true if this Rule's mathematical expression is 348 * set. 349 * 350 * This method is equivalent to isSetMath(). This version is present for 351 * easier compatibility with SBML Level 1, in which mathematical 352 * formulas were written in text-string form. 353 * 354 * @return @c true if the mathematical formula for this Rule is 355 * set, @c false otherwise. 356 * 357 * @note The attribute 'formula' is specific to SBML Level 1; in 358 * higher Levels of SBML, it has been replaced with a subelement named 359 * 'math'. However, libSBML provides a unified interface to the 360 * underlying math expression and this method can be used for models 361 * of all Levels of SBML. 362 * 363 * @see isSetMath() 364 */ public isSetFormula()365 bool isSetFormula() { 366 bool ret = libsbmlPINVOKE.Rule_isSetFormula(swigCPtr); 367 return ret; 368 } 369 370 371 /** 372 * Predicate returning @c true if this Rule's mathematical expression is 373 * set. 374 * 375 * This method is equivalent to isSetFormula(). 376 * 377 * @return @c true if the formula (or equivalently the math) for this 378 * Rule is set, @c false otherwise. 379 * 380 * @note The subelement 'math' is present in SBML Levels 2 381 * and 3. In SBML Level 1, the equivalent construct is the 382 * attribute named 'formula'. LibSBML provides a unified interface to 383 * the underlying math expression and this method can be used for models 384 * of all Levels of SBML. 385 * 386 * @see isSetFormula() 387 */ public isSetMath()388 bool isSetMath() { 389 bool ret = libsbmlPINVOKE.Rule_isSetMath(swigCPtr); 390 return ret; 391 } 392 393 394 /** 395 * Predicate returning @c true if this Rule's 'variable' attribute is set. 396 * 397 * 398 * 399 * In SBML Level 1, the different rule types each have a different 400 * name for the attribute holding the reference to the object constituting 401 * the left-hand side of the rule. (E.g., for SBML Level 1's 402 * SpeciesConcentrationRule the attribute is 'species', for 403 * CompartmentVolumeRule it is 'compartment', etc.) In SBML Levels 2 404 * and 3, the only two types of Rule objects with a left-hand side 405 * object reference are AssignmentRule and RateRule, and both of them use the 406 * same name for attribute: 'variable'. In order to make it easier for 407 * application developers to work with all Levels of SBML, libSBML uses a 408 * uniform name for all such attributes, and it is 'variable', regardless of 409 * whether Level 1 rules or Level 2–3 rules are being used. 410 * 411 * 412 * @return @c true if the 'variable' attribute value of this Rule is 413 * set, @c false otherwise. 414 */ public isSetVariable()415 bool isSetVariable() { 416 bool ret = libsbmlPINVOKE.Rule_isSetVariable(swigCPtr); 417 return ret; 418 } 419 420 421 /** 422 * Predicate returning @c true if this Rule's 'units' attribute is set. 423 * 424 * @return @c true if the units for this Rule is set, @c false 425 * otherwise. 426 * 427 * @note The attribute 'units' exists on SBML Level 1 ParameterRule 428 * objects only. It is not present in SBML Levels 2 and 3. 429 */ public isSetUnits()430 bool isSetUnits() { 431 bool ret = libsbmlPINVOKE.Rule_isSetUnits(swigCPtr); 432 return ret; 433 } 434 435 436 /** 437 * Sets the 'math' subelement of this Rule to an expression in text-string 438 * form. 439 * 440 * This is equivalent to setMath(ASTNode math). The provision of 441 * using text-string formulas is retained for easier SBML Level 1 442 * compatibility. The formula is converted to an ASTNode internally. 443 * 444 * @param formula a mathematical formula in text-string form. 445 * 446 * 447 * @return integer value indicating success/failure of the 448 * function. @if clike The value is drawn from the 449 * enumeration #OperationReturnValues_t. @endif The possible values 450 * returned by this function are: 451 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 452 * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink 453 * 454 * @note The attribute 'formula' is specific to SBML Level 1; in 455 * higher Levels of SBML, it has been replaced with a subelement named 456 * 'math'. However, libSBML provides a unified interface to the 457 * underlying math expression and this method can be used for models 458 * of all Levels of SBML. 459 * 460 * @see setMath(ASTNode math) 461 */ public setFormula(string formula)462 int setFormula(string formula) { 463 int ret = libsbmlPINVOKE.Rule_setFormula(swigCPtr, formula); 464 return ret; 465 } 466 467 468 /** 469 * Sets the 'math' subelement of this Rule to a copy of the given 470 * ASTNode. 471 * 472 * @param math the AST structure of the mathematical formula. 473 * 474 * 475 * @return integer value indicating success/failure of the 476 * function. @if clike The value is drawn from the 477 * enumeration #OperationReturnValues_t. @endif The possible values 478 * returned by this function are: 479 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 480 * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink 481 * 482 * @note The subelement 'math' is present in SBML Levels 2 483 * and 3. In SBML Level 1, the equivalent construct is the 484 * attribute named 'formula'. LibSBML provides a unified interface to 485 * the underlying math expression and this method can be used for models 486 * of all Levels of SBML. 487 * 488 * @see setFormula(string formula) 489 */ public new setMath(ASTNode math)490 int setMath(ASTNode math) { 491 int ret = libsbmlPINVOKE.Rule_setMath(swigCPtr, ASTNode.getCPtr(math)); 492 return ret; 493 } 494 495 496 /** 497 * Sets the 'variable' attribute value of this Rule object. 498 * 499 * 500 * 501 * In SBML Level 1, the different rule types each have a different 502 * name for the attribute holding the reference to the object constituting 503 * the left-hand side of the rule. (E.g., for SBML Level 1's 504 * SpeciesConcentrationRule the attribute is 'species', for 505 * CompartmentVolumeRule it is 'compartment', etc.) In SBML Levels 2 506 * and 3, the only two types of Rule objects with a left-hand side 507 * object reference are AssignmentRule and RateRule, and both of them use the 508 * same name for attribute: 'variable'. In order to make it easier for 509 * application developers to work with all Levels of SBML, libSBML uses a 510 * uniform name for all such attributes, and it is 'variable', regardless of 511 * whether Level 1 rules or Level 2–3 rules are being used. 512 * 513 * 514 * @param sid the identifier of a Compartment, Species or Parameter 515 * elsewhere in the enclosing Model object. 516 * 517 * 518 * @return integer value indicating success/failure of the 519 * function. @if clike The value is drawn from the 520 * enumeration #OperationReturnValues_t. @endif The possible values 521 * returned by this function are: 522 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 523 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 524 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 525 */ public setVariable(string sid)526 int setVariable(string sid) { 527 int ret = libsbmlPINVOKE.Rule_setVariable(swigCPtr, sid); 528 return ret; 529 } 530 531 532 /** 533 * Sets the units for this Rule. 534 * 535 * @param sname the identifier of the units. 536 * 537 * 538 * @return integer value indicating success/failure of the 539 * function. @if clike The value is drawn from the 540 * enumeration #OperationReturnValues_t. @endif The possible values 541 * returned by this function are: 542 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 543 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 544 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 545 * 546 * @note The attribute 'units' exists on SBML Level 1 ParameterRule 547 * objects only. It is not present in SBML Levels 2 and 3. 548 */ public setUnits(string sname)549 int setUnits(string sname) { 550 int ret = libsbmlPINVOKE.Rule_setUnits(swigCPtr, sname); 551 return ret; 552 } 553 554 555 /** 556 * Unsets the value of the 'variable' attribute of this Rule object. 557 * 558 * 559 * @return integer value indicating success/failure of the 560 * function. @if clike The value is drawn from the 561 * enumeration #OperationReturnValues_t. @endif The possible values 562 * returned by this function are: 563 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 564 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 565 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 566 * 567 * @see setVariable(string sid) 568 * @see isSetVariable() 569 * @see getVariable() 570 */ public unsetVariable()571 int unsetVariable() { 572 int ret = libsbmlPINVOKE.Rule_unsetVariable(swigCPtr); 573 return ret; 574 } 575 576 577 /** 578 * Unsets the 'units' for this Rule. 579 * 580 * 581 * @return integer value indicating success/failure of the 582 * function. @if clike The value is drawn from the 583 * enumeration #OperationReturnValues_t. @endif The possible values 584 * returned by this function are: 585 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 586 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 587 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 588 * 589 * @note The attribute 'units' exists on SBML Level 1 ParameterRule 590 * objects only. It is not present in SBML Levels 2 and 3. 591 */ public unsetUnits()592 int unsetUnits() { 593 int ret = libsbmlPINVOKE.Rule_unsetUnits(swigCPtr); 594 return ret; 595 } 596 597 598 /** 599 * Calculates and returns a UnitDefinition that expresses the units of 600 * measurement assumed for the 'math' expression of this Rule. 601 * 602 * 603 * 604 * The units are calculated based on the mathematical expression in the 605 * Rule and the model quantities referenced by <code><ci></code> 606 * elements used within that expression. The method 607 * Rule::getDerivedUnitDefinition() returns the calculated units, to the 608 * extent that libSBML can compute them. 609 * 610 * 611 * 612 * @note The functionality that facilitates unit analysis depends on the 613 * model as a whole. Thus, in cases where the object has not been added to 614 * a model or the model itself is incomplete, unit analysis is not possible 615 * and this method will return @c null. 616 * 617 * 618 * 619 * 620 * @warning <span class='warning'>Note that it is possible the 'math' 621 * expression in the Rule contains pure numbers or parameters with undeclared 622 * units. In those cases, it is not possible to calculate the units of the 623 * overall expression without making assumptions. LibSBML does not make 624 * assumptions about the units, and Rule::getDerivedUnitDefinition() only 625 * returns the units as far as it is able to determine them. For example, in 626 * an expression <em>X + Y</em>, if <em>X</em> has unambiguously-defined 627 * units and <em>Y</em> does not, it will return the units of <em>X</em>. 628 * <strong>It is important that callers also invoke the method</strong> 629 * Rule::containsUndeclaredUnits() <strong>to determine whether this 630 * situation holds</strong>. Callers may wish to take suitable actions in 631 * those scenarios.</span> 632 * 633 * 634 * @return a UnitDefinition that expresses the units of the math 635 * expression of this Rule, or @c null if one cannot be constructed. 636 * 637 * @see containsUndeclaredUnits() 638 */ public getDerivedUnitDefinition()639 UnitDefinition getDerivedUnitDefinition() { 640 global::System.IntPtr cPtr = libsbmlPINVOKE.Rule_getDerivedUnitDefinition__SWIG_0(swigCPtr); 641 UnitDefinition ret = (cPtr == global::System.IntPtr.Zero) ? null : new UnitDefinition(cPtr, false); 642 return ret; 643 } 644 645 646 /** 647 * Predicate returning @c true if the math expression of this Rule contains 648 * parameters/numbers with undeclared units. 649 * 650 * @return @c true if the math expression of this Rule includes 651 * parameters/numbers with undeclared units, @c false otherwise. 652 * 653 * @note A return value of @c true indicates that the UnitDefinition 654 * returned by getDerivedUnitDefinition() may not accurately represent 655 * the units of the expression. 656 * 657 * @see getDerivedUnitDefinition() 658 */ public containsUndeclaredUnits()659 bool containsUndeclaredUnits() { 660 bool ret = libsbmlPINVOKE.Rule_containsUndeclaredUnits__SWIG_0(swigCPtr); 661 return ret; 662 } 663 664 665 /** 666 * Returns a code representing the type of rule this is. 667 * 668 * @return the rule type, which will be one of the following three possible 669 * values: 670 * @li @link libsbml#RULE_TYPE_RATE RULE_TYPE_RATE@endlink 671 * @li @link libsbml#RULE_TYPE_SCALAR RULE_TYPE_SCALAR@endlink 672 * @li @link libsbml#RULE_TYPE_INVALID RULE_TYPE_INVALID@endlink 673 * 674 * @note The attribute 'type' on Rule objects is present only in SBML 675 * Level 1. In SBML Level 2 and later, the type has been 676 * replaced by subclassing the Rule object. 677 */ public getType()678 int getType() { 679 int ret = libsbmlPINVOKE.Rule_getType(swigCPtr); 680 return ret; 681 } 682 683 684 /** 685 * Predicate returning @c true if this Rule is an AlgebraicRule. 686 * 687 * @return @c true if this Rule is an AlgebraicRule, @c false otherwise. 688 */ public isAlgebraic()689 bool isAlgebraic() { 690 bool ret = libsbmlPINVOKE.Rule_isAlgebraic(swigCPtr); 691 return ret; 692 } 693 694 695 /** 696 * Predicate returning @c true if this Rule is an AssignmentRule. 697 * 698 * @return @c true if this Rule is an AssignmentRule, @c false otherwise. 699 */ public isAssignment()700 bool isAssignment() { 701 bool ret = libsbmlPINVOKE.Rule_isAssignment(swigCPtr); 702 return ret; 703 } 704 705 706 /** 707 * Predicate returning @c true if this Rule is an CompartmentVolumeRule 708 * or equivalent. 709 * 710 * This libSBML method works for SBML Level 1 models (where there is 711 * such a thing as an explicit CompartmentVolumeRule), as well as other Levels of 712 * SBML. For Levels above Level 1, this method checks the symbol 713 * being affected by the rule, and returns @c true if the symbol is the 714 * identifier of a Compartment object defined in the model. 715 * 716 * @return @c true if this Rule is a CompartmentVolumeRule, @c false 717 * otherwise. 718 */ public isCompartmentVolume()719 bool isCompartmentVolume() { 720 bool ret = libsbmlPINVOKE.Rule_isCompartmentVolume(swigCPtr); 721 return ret; 722 } 723 724 725 /** 726 * Predicate returning @c true if this Rule is an ParameterRule or 727 * equivalent. 728 * 729 * This libSBML method works for SBML Level 1 models (where there is 730 * such a thing as an explicit ParameterRule), as well as other Levels of 731 * SBML. For Levels above Level 1, this method checks the symbol 732 * being affected by the rule, and returns @c true if the symbol is the 733 * identifier of a Parameter object defined in the model. 734 * 735 * @return @c true if this Rule is a ParameterRule, @c false 736 * otherwise. 737 */ public isParameter()738 bool isParameter() { 739 bool ret = libsbmlPINVOKE.Rule_isParameter(swigCPtr); 740 return ret; 741 } 742 743 744 /** 745 * Predicate returning @c true if this Rule is a RateRule (SBML 746 * Levels 2–3) or has a 'type' attribute value of @c 'rate' 747 * (SBML Level 1). 748 * 749 * @return @c true if this Rule is a RateRule (Level 2) or has 750 * type 'rate' (Level 1), @c false otherwise. 751 */ public isRate()752 bool isRate() { 753 bool ret = libsbmlPINVOKE.Rule_isRate(swigCPtr); 754 return ret; 755 } 756 757 758 /** 759 * Predicate returning @c true if this Rule is an AssignmentRule (SBML 760 * Levels 2–3) or has a 'type' attribute value of @c 'scalar' 761 * (SBML Level 1). 762 * 763 * @return @c true if this Rule is an AssignmentRule (Level 2) or has 764 * type 'scalar' (Level 1), @c false otherwise. 765 */ public isScalar()766 bool isScalar() { 767 bool ret = libsbmlPINVOKE.Rule_isScalar(swigCPtr); 768 return ret; 769 } 770 771 772 /** 773 * Predicate returning @c true if this Rule is a SpeciesConcentrationRule 774 * or equivalent. 775 * 776 * This libSBML method works for SBML Level 1 models (where there is 777 * such a thing as an explicit SpeciesConcentrationRule), as well as 778 * other Levels of SBML. For Levels above Level 1, this method 779 * checks the symbol being affected by the rule, and returns @c true if 780 * the symbol is the identifier of a Species object defined in the model. 781 * 782 * @return @c true if this Rule is a SpeciesConcentrationRule, @c false 783 * otherwise. 784 */ public isSpeciesConcentration()785 bool isSpeciesConcentration() { 786 bool ret = libsbmlPINVOKE.Rule_isSpeciesConcentration(swigCPtr); 787 return ret; 788 } 789 790 791 /** 792 * Returns the libSBML type code for this %SBML object. 793 * 794 * 795 * 796 * LibSBML attaches an identifying code to every kind of SBML object. These 797 * are integer constants known as <em>SBML type codes</em>. The names of all 798 * the codes begin with the characters <code>SBML_</code>. 799 * @if clike The set of possible type codes for core elements is defined in 800 * the enumeration #SBMLTypeCode_t, and in addition, libSBML plug-ins for 801 * SBML Level 3 packages define their own extra enumerations of type 802 * codes (e.g., #SBMLLayoutTypeCode_t for the Level 3 Layout 803 * package).@endif@if java In the Java language interface for libSBML, the 804 * type codes are defined as static integer constants in the interface class 805 * {@link libsbmlConstants}. @endif@if python In the Python language 806 * interface for libSBML, the type codes are defined as static integer 807 * constants in the interface class @link libsbml@endlink.@endif@if csharp In 808 * the C# language interface for libSBML, the type codes are defined as 809 * static integer constants in the interface class 810 * @link libsbmlcs.libsbml@endlink.@endif Note that different Level 3 811 * package plug-ins may use overlapping type codes; to identify the package 812 * to which a given object belongs, call the 813 * <code>@if conly SBase_getPackageName() 814 * @else SBase::getPackageName() 815 * @endif</code> 816 * method on the object. 817 * 818 * The exception to this is lists: all SBML-style list elements have the type 819 * @link libsbml#SBML_LIST_OF SBML_LIST_OF@endlink, regardless of what package they 820 * are from. 821 * 822 * 823 * 824 * @return the SBML type code for this object, either 825 * @link libsbml#SBML_ASSIGNMENT_RULE SBML_ASSIGNMENT_RULE@endlink, 826 * @link libsbml#SBML_RATE_RULE SBML_RATE_RULE@endlink, or 827 * @link libsbml#SBML_ALGEBRAIC_RULE SBML_ALGEBRAIC_RULE@endlink 828 * for %SBML Core. 829 * 830 * 831 * @warning <span class='warning'>The specific integer values of the possible 832 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 833 * packages, To fully identify the correct code, <strong>it is necessary to 834 * invoke both getPackageName() and getTypeCode()</strong> (or 835 * ListOf::getItemTypeCode()).</span> 836 * 837 * 838 * 839 * @see getElementName() 840 * @see getPackageName() 841 */ public new getTypeCode()842 int getTypeCode() { 843 int ret = libsbmlPINVOKE.Rule_getTypeCode(swigCPtr); 844 return ret; 845 } 846 847 848 /** 849 * Returns the SBML Level 1 type code for this Rule object. 850 * 851 * This method only applies to SBML Level 1 model objects. If this is 852 * not an SBML Level 1 rule object, this method will return 853 * @link libsbml#SBML_UNKNOWN SBML_UNKNOWN@endlink. 854 * 855 * @return the SBML Level 1 type code for this Rule (namely, 856 * @link libsbml#SBML_COMPARTMENT_VOLUME_RULE SBML_COMPARTMENT_VOLUME_RULE@endlink, 857 * @link libsbml#SBML_PARAMETER_RULE SBML_PARAMETER_RULE@endlink, 858 * @link libsbml#SBML_SPECIES_CONCENTRATION_RULE SBML_SPECIES_CONCENTRATION_RULE@endlink, or 859 * @link libsbml#SBML_UNKNOWN SBML_UNKNOWN@endlink). 860 */ public getL1TypeCode()861 int getL1TypeCode() { 862 int ret = libsbmlPINVOKE.Rule_getL1TypeCode(swigCPtr); 863 return ret; 864 } 865 866 867 /** 868 * Returns the XML element name of this object. 869 * 870 * The returned value can be any of a number of different strings, 871 * depending on the SBML Level in use and the kind of Rule object this 872 * is. The rules as of libSBML version @htmlinclude libsbml-version.html 873 * are the following: 874 * <ul> 875 * <li> (Level 2 and 3) RateRule: returns @c 'rateRule' 876 * <li> (Level 2 and 3) AssignmentRule: returns @c 'assignmentRule' 877 * <li> (Level 2 and 3) AlgebraicRule: returns @c 'algebraicRule' 878 * <li> (Level 1 Version 1) SpecieConcentrationRule: returns @c 'specieConcentrationRule' 879 * <li> (Level 1 Version 2) SpeciesConcentrationRule: returns @c 'speciesConcentrationRule' 880 * <li> (Level 1) CompartmentVolumeRule: returns @c 'compartmentVolumeRule' 881 * <li> (Level 1) ParameterRule: returns @c 'parameterRule' 882 * <li> Unknown rule type: returns @c 'unknownRule' 883 * </ul> 884 * 885 * Beware that the last (@c 'unknownRule') is not a valid SBML element 886 * name. 887 * 888 * @return the name of this element. 889 */ public new getElementName()890 string getElementName() { 891 string ret = libsbmlPINVOKE.Rule_getElementName(swigCPtr); 892 return ret; 893 } 894 895 896 /** 897 * Sets the SBML Level 1 type code for this Rule. 898 * 899 * @param type the SBML Level 1 type code for this Rule. The allowable 900 * values are @link libsbml#SBML_COMPARTMENT_VOLUME_RULE SBML_COMPARTMENT_VOLUME_RULE@endlink, 901 * @link libsbml#SBML_PARAMETER_RULE SBML_PARAMETER_RULE@endlink, and 902 * @link libsbml#SBML_SPECIES_CONCENTRATION_RULE SBML_SPECIES_CONCENTRATION_RULE@endlink. 903 * 904 * 905 * @return integer value indicating success/failure of the 906 * function. @if clike The value is drawn from the 907 * enumeration #OperationReturnValues_t. @endif The possible values 908 * returned by this function are: 909 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 910 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 911 * if given @p type value is not one of the above. 912 */ public setL1TypeCode(int type)913 int setL1TypeCode(int type) { 914 int ret = libsbmlPINVOKE.Rule_setL1TypeCode(swigCPtr, type); 915 return ret; 916 } 917 918 919 /** 920 * Predicate returning @c true if all the required elements for this Rule 921 * object have been set. 922 * 923 * The only required element for a Rule object is the 'math' subelement in 924 * SBML Level 2 and Level 3 Version 1. In SBML Level 3 925 * Version 2+, it is no longer required. 926 * 927 * @return a boolean value indicating whether all the required 928 * elements for this object have been defined. 929 */ public new hasRequiredElements()930 bool hasRequiredElements() { 931 bool ret = libsbmlPINVOKE.Rule_hasRequiredElements(swigCPtr); 932 return ret; 933 } 934 935 936 /** 937 * Predicate returning @c true if all the required attributes for this Rule 938 * object have been set. 939 * 940 * The required attributes for a Rule object depend on the type of Rule 941 * it is. For AssignmentRule and RateRule objects (and SBML 942 * Level 1's SpeciesConcentrationRule, CompartmentVolumeRule, and 943 * ParameterRule objects), the required attribute is 'variable'; for 944 * AlgebraicRule objects, there is no required attribute. 945 * 946 * @return @c true if the required attributes have been set, @c false 947 * otherwise. 948 */ public new hasRequiredAttributes()949 bool hasRequiredAttributes() { 950 bool ret = libsbmlPINVOKE.Rule_hasRequiredAttributes(swigCPtr); 951 return ret; 952 } 953 954 955 /** 956 * 957 * Replaces all uses of a given @c SIdRef type attribute value with another 958 * value. 959 * 960 * 961 * 962 963 * In SBML, object identifiers are of a data type called <code>SId</code>. 964 * In SBML Level 3, an explicit data type called <code>SIdRef</code> was 965 * introduced for attribute values that refer to <code>SId</code> values; in 966 * previous Levels of SBML, this data type did not exist and attributes were 967 * simply described to as 'referring to an identifier', but the effective 968 * data type was the same as <code>SIdRef</code> in Level 3. These and 969 * other methods of libSBML refer to the type <code>SIdRef</code> for all 970 * Levels of SBML, even if the corresponding SBML specification did not 971 * explicitly name the data type. 972 * 973 * 974 * 975 * This method works by looking at all attributes and (if appropriate) 976 * mathematical formulas in MathML content, comparing the referenced 977 * identifiers to the value of @p oldid. If any matches are found, the 978 * matching values are replaced with @p newid. The method does @em not 979 * descend into child elements. 980 * 981 * @param oldid the old identifier. 982 * @param newid the new identifier. 983 * 984 * 985 */ public new renameSIdRefs(string oldid, string newid)986 void renameSIdRefs(string oldid, string newid) { 987 libsbmlPINVOKE.Rule_renameSIdRefs(swigCPtr, oldid, newid); 988 } 989 990 991 /** 992 * 993 * Replaces all uses of a given @c UnitSIdRef type attribute value with 994 * another value. 995 * 996 * 997 * 998 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>. In 999 * SBML Level 3, an explicit data type called <code>UnitSIdRef</code> was 1000 * introduced for attribute values that refer to <code>UnitSId</code> values; in 1001 * previous Levels of SBML, this data type did not exist and attributes were 1002 * simply described to as 'referring to a unit identifier', but the effective 1003 * data type was the same as <code>UnitSIdRef</code> in Level 3. These and 1004 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all 1005 * Levels of SBML, even if the corresponding SBML specification did not 1006 * explicitly name the data type. 1007 * 1008 * 1009 * 1010 * This method works by looking at all unit identifier attribute values 1011 * (including, if appropriate, inside mathematical formulas), comparing the 1012 * referenced unit identifiers to the value of @p oldid. If any matches 1013 * are found, the matching values are replaced with @p newid. The method 1014 * does @em not descend into child elements. 1015 * 1016 * @param oldid the old identifier. 1017 * @param newid the new identifier. 1018 * 1019 * 1020 */ public new renameUnitSIdRefs(string oldid, string newid)1021 void renameUnitSIdRefs(string oldid, string newid) { 1022 libsbmlPINVOKE.Rule_renameUnitSIdRefs(swigCPtr, oldid, newid); 1023 } 1024 1025 1026 /** 1027 * Returns the value of the 'variable' attribute of this Rule (NOT the 'id'). 1028 * 1029 * @note Because of the inconsistent behavior of this function with 1030 * respect to assignments and rules, it is now recommended to 1031 * use the getIdAttribute() or the getVariable() function instead. 1032 * 1033 * The 'variable' attribute of a Rule indicates the element which 1034 * the results of the 'math' are to be applied. An AlgebraicRule has 1035 * no 'variable', and will always return an empty string. 1036 * 1037 * @return the variable of this Rule. 1038 * 1039 * @see getIdAttribute() 1040 * @see setIdAttribute(string sid) 1041 * @see isSetIdAttribute() 1042 * @see unsetIdAttribute() 1043 * @see getVariable() 1044 */ public new getId()1045 string getId() { 1046 string ret = libsbmlPINVOKE.Rule_getId(swigCPtr); 1047 return ret; 1048 } 1049 1050 1051 /** */ /* libsbml-internal */ public new replaceSIDWithFunction(string id, ASTNode function)1052 void replaceSIDWithFunction(string id, ASTNode function) { 1053 libsbmlPINVOKE.Rule_replaceSIDWithFunction(swigCPtr, id, ASTNode.getCPtr(function)); 1054 } 1055 1056 1057 /** */ /* libsbml-internal */ public new divideAssignmentsToSIdByFunction(string id, ASTNode function)1058 void divideAssignmentsToSIdByFunction(string id, ASTNode function) { 1059 libsbmlPINVOKE.Rule_divideAssignmentsToSIdByFunction(swigCPtr, id, ASTNode.getCPtr(function)); 1060 } 1061 1062 1063 /** */ /* libsbml-internal */ public new multiplyAssignmentsToSIdByFunction(string id, ASTNode function)1064 void multiplyAssignmentsToSIdByFunction(string id, ASTNode function) { 1065 libsbmlPINVOKE.Rule_multiplyAssignmentsToSIdByFunction(swigCPtr, id, ASTNode.getCPtr(function)); 1066 } 1067 1068 } 1069 1070 } 1071