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 delay on the time of execution of an SBML <em>event</em>. 20 * 21 * An Event object defines when the event can occur, the variables that 22 * are affected by the event, and how the variables are affected. The 23 * effect of the event can optionally be delayed after the occurrence of 24 * the condition which invokes it. An event delay is defined using an 25 * object of class Delay. 26 * 27 * The object class Delay is derived from SBase and adds a single 28 * subelement called 'math'. This subelement is used to hold MathML 29 * content. The mathematical formula represented by 'math' must evaluate 30 * to a numerical value. It is used as the length of time between when the 31 * event is @em triggered and when the event's assignments are 32 * actually @em executed. If no delay is present on a given Event, a time 33 * delay of zero is assumed. 34 * 35 * The expression in 'math' must be evaluated at the time the event is @em 36 * triggered. The expression must always evaluate to a nonnegative number 37 * (otherwise, a nonsensical situation could arise where an event is 38 * defined to execute before it is triggered!). 39 * 40 * @section delay-units The units of the mathematical expression in a Delay 41 * 42 * In SBML Level 2 versions before Version 4, the units of the 43 * numerical value computed by the Delay's 'math' expression are @em 44 * required to be in units of time, or the model is considered to have a 45 * unit consistency error. In Level 2 Version 4 as well as SBML 46 * Level 3, this requirement is relaxed; these 47 * specifications only stipulate that the units of the numerical value 48 * computed by a Delay instance's 'math' expression @em should match the 49 * model's units of time (meaning the definition of the @c time units in 50 * the model). LibSBML respects these requirements, and depending on 51 * whether an earlier Version of SBML Level 2 is in use, libSBML may 52 * or may not flag unit inconsistencies as errors or merely warnings. 53 * 54 * Note that <em>units are not predefined or assumed</em> for the contents 55 * of 'math' in a Delay object; rather, they must be defined explicitly for 56 * each instance of a Delay object in a model. This is an important point 57 * to bear in mind when literal numbers are used in delay expressions. For 58 * example, the following Event instance would result in a warning logged 59 * by SBMLDocument::checkConsistency() about the fact that libSBML cannot 60 * verify the consistency of the units of the expression. The reason is 61 * that the formula inside the 'math' element does not have any declared 62 * units, whereas what is expected in this context is units of time: 63 * @verbatim 64 <model> 65 ... 66 <listOfEvents> 67 <event useValuesFromTriggerTime='true'> 68 ... 69 <delay> 70 <math xmlns='http://www.w3.org/1998/Math/MathML'> 71 <cn> 1 </cn> 72 </math> 73 </delay> 74 ... 75 </event> 76 </listOfEvents> 77 ... 78 </model> 79 @endverbatim 80 * 81 * The <code><cn> 1 </cn></code> within the mathematical formula 82 * of the @c delay above has <em>no units declared</em>. To make the 83 * expression have the needed units of time, literal numbers should be 84 * avoided in favor of defining Parameter objects for each quantity, and 85 * declaring units for the Parameter values. The following fragment of 86 * SBML illustrates this approach: 87 * @verbatim 88 <model> 89 ... 90 <listOfParameters> 91 <parameter id='transcriptionDelay' value='10' units='second'/> 92 </listOfParameters> 93 ... 94 <listOfEvents> 95 <event useValuesFromTriggerTime='true'> 96 ... 97 <delay> 98 <math xmlns='http://www.w3.org/1998/Math/MathML'> 99 <ci> transcriptionDelay </ci> 100 </math> 101 </delay> 102 ... 103 </event> 104 </listOfEvents> 105 ... 106 </model> 107 @endverbatim 108 * 109 * In SBML Level 3, an alternative approach is available in the form 110 * of the @c units attribute, which SBML Level 3 allows to appear on 111 * MathML @c cn elements. The value of this attribute can be used to 112 * indicate the unit of measurement to be associated with the number in the 113 * content of a @c cn element. The attribute is named @c units but, 114 * because it appears inside MathML element (which is in the XML namespace 115 * for MathML and not the namespace for SBML), it must always be prefixed 116 * with an XML namespace prefix for an SBML Level 3 117 * namespace. The following is an example of this approach: 118 * @verbatim 119 <model timeUnits='second' ...> 120 ... 121 <listOfEvents> 122 <event useValuesFromTriggerTime='true'> 123 ... 124 <delay> 125 <math xmlns='http://www.w3.org/1998/Math/MathML' 126 xmlns:sbml='http://www.sbml.org/sbml/level3/version1/core'> 127 <cn sbml:units='second'> 10 </cn> 128 </math> 129 </delay> 130 ... 131 </event> 132 </listOfEvents> 133 ... 134 </model> 135 @endverbatim 136 * 137 * @section delay-restrictions Restrictions relaxed in SBML Level 3 Version 2 138 * 139 * In SBML Level 3 Version 2, the requirement that a Delay 140 * have a 'math' subelement was relaxed, making it optional. In 141 * this case, the Delay remains undefined, and unless that information 142 * is provided in some other form (such as with an SBML Level 3 143 * package), the Event behaves as if it had no Delay. 144 */ 145 146 public class Delay : SBase { 147 private HandleRef swigCPtr; 148 Delay(IntPtr cPtr, bool cMemoryOwn)149 internal Delay(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.Delay_SWIGUpcast(cPtr), cMemoryOwn) 150 { 151 //super(libsbmlPINVOKE.DelayUpcast(cPtr), cMemoryOwn); 152 swigCPtr = new HandleRef(this, cPtr); 153 } 154 getCPtr(Delay obj)155 internal static HandleRef getCPtr(Delay obj) 156 { 157 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 158 } 159 getCPtrAndDisown(Delay obj)160 internal static HandleRef getCPtrAndDisown (Delay obj) 161 { 162 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 163 164 if (obj != null) 165 { 166 ptr = obj.swigCPtr; 167 obj.swigCMemOwn = false; 168 } 169 170 return ptr; 171 } 172 Dispose(bool disposing)173 protected override void Dispose(bool disposing) { 174 lock(this) { 175 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 176 if (swigCMemOwn) { 177 swigCMemOwn = false; 178 libsbmlPINVOKE.delete_Delay(swigCPtr); 179 } 180 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 181 } 182 base.Dispose(disposing); 183 } 184 } 185 186 187 /** 188 * Creates a new Delay using the given SBML @p level and @p version 189 * values. 190 * 191 * @param level a long integer, the SBML Level to assign to this Delay. 192 * 193 * @param version a long integer, the SBML Version to assign to this 194 * Delay. 195 * 196 * 197 * @throws SBMLConstructorException 198 * Thrown if the given @p level and @p version combination are invalid 199 * or if this object is incompatible with the given level and version. 200 * 201 * 202 * 203 * 204 * @note Attempting to add an object to an SBMLDocument having a different 205 * combination of SBML Level, Version and XML namespaces than the object 206 * itself will result in an error at the time a caller attempts to make the 207 * addition. A parent object must have compatible Level, Version and XML 208 * namespaces. (Strictly speaking, a parent may also have more XML 209 * namespaces than a child, but the reverse is not permitted.) The 210 * restriction is necessary to ensure that an SBML model has a consistent 211 * overall structure. This requires callers to manage their objects 212 * carefully, but the benefit is increased flexibility in how models can be 213 * created by permitting callers to create objects bottom-up if desired. In 214 * situations where objects are not yet attached to parents (e.g., 215 * SBMLDocument), knowledge of the intented SBML Level and Version help 216 * libSBML determine such things as whether it is valid to assign a 217 * particular value to an attribute. 218 * 219 * 220 */ public Delay(long level, long version)221 Delay(long level, long version) : this(libsbmlPINVOKE.new_Delay__SWIG_0(level, version), true) { 222 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 223 } 224 225 226 /** 227 * Creates a new Delay using the given SBMLNamespaces object 228 * @p sbmlns. 229 * 230 * 231 * 232 * The SBMLNamespaces object encapsulates SBML Level/Version/namespaces 233 * information. It is used to communicate the SBML Level, Version, and (in 234 * Level 3) packages used in addition to SBML Level 3 Core. A 235 * common approach to using libSBML's SBMLNamespaces facilities is to create an 236 * SBMLNamespaces object somewhere in a program once, then hand that object 237 * as needed to object constructors that accept SBMLNamespaces as arguments. 238 * 239 * 240 * 241 * @param sbmlns an SBMLNamespaces object. 242 * 243 * 244 * @throws SBMLConstructorException 245 * Thrown if the given @p sbmlns is inconsistent or incompatible 246 * with this object. 247 * 248 * 249 * 250 * 251 * @note Attempting to add an object to an SBMLDocument having a different 252 * combination of SBML Level, Version and XML namespaces than the object 253 * itself will result in an error at the time a caller attempts to make the 254 * addition. A parent object must have compatible Level, Version and XML 255 * namespaces. (Strictly speaking, a parent may also have more XML 256 * namespaces than a child, but the reverse is not permitted.) The 257 * restriction is necessary to ensure that an SBML model has a consistent 258 * overall structure. This requires callers to manage their objects 259 * carefully, but the benefit is increased flexibility in how models can be 260 * created by permitting callers to create objects bottom-up if desired. In 261 * situations where objects are not yet attached to parents (e.g., 262 * SBMLDocument), knowledge of the intented SBML Level and Version help 263 * libSBML determine such things as whether it is valid to assign a 264 * particular value to an attribute. 265 * 266 * 267 */ public Delay(SBMLNamespaces sbmlns)268 Delay(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_Delay__SWIG_1(SBMLNamespaces.getCPtr(sbmlns)), true) { 269 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 270 } 271 272 273 /** 274 * Copy constructor; creates a copy of this Delay. 275 * 276 * @param orig the object to copy. 277 */ public Delay(Delay orig)278 Delay(Delay orig) : this(libsbmlPINVOKE.new_Delay__SWIG_2(Delay.getCPtr(orig)), true) { 279 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 280 } 281 282 283 /** 284 * Creates and returns a deep copy of this Delay object. 285 * 286 * @return the (deep) copy of this Delay object. 287 */ public new clone()288 Delay clone() { 289 global::System.IntPtr cPtr = libsbmlPINVOKE.Delay_clone(swigCPtr); 290 Delay ret = (cPtr == global::System.IntPtr.Zero) ? null : new Delay(cPtr, true); 291 return ret; 292 } 293 294 295 /** 296 * Get the mathematical formula for the delay and return it 297 * as an AST. 298 * 299 * @return the math of this Delay, or @c null if the math is not set. 300 */ public new getMath()301 ASTNode getMath() { 302 global::System.IntPtr cPtr = libsbmlPINVOKE.Delay_getMath(swigCPtr); 303 ASTNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new ASTNode(cPtr, false); 304 return ret; 305 } 306 307 308 /** 309 * Predicate to test whether the formula for this delay is set. 310 * 311 * @return @c true if the formula (meaning the @c math subelement) of 312 * this Delay is set, @c false otherwise. 313 */ public isSetMath()314 bool isSetMath() { 315 bool ret = libsbmlPINVOKE.Delay_isSetMath(swigCPtr); 316 return ret; 317 } 318 319 320 /** 321 * Sets the delay expression of this Delay instance to a copy of the given 322 * ASTNode. 323 * 324 * @param math an ASTNode representing a formula tree. 325 * 326 * 327 * @return integer value indicating success/failure of the 328 * function. @if clike The value is drawn from the 329 * enumeration #OperationReturnValues_t. @endif The possible values 330 * returned by this function are: 331 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 332 * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink 333 */ public new setMath(ASTNode math)334 int setMath(ASTNode math) { 335 int ret = libsbmlPINVOKE.Delay_setMath(swigCPtr, ASTNode.getCPtr(math)); 336 return ret; 337 } 338 339 340 /** 341 * Calculates and returns a UnitDefinition that expresses the units 342 * of measurement assumed for the 'math' expression of this Delay. 343 * 344 * 345 * 346 * Delay elements in SBML express a time delay for an Event. Beginning 347 * with SBML Level 2 Version 2, the units of that time are 348 * calculated based on the mathematical expression and the model quantities 349 * referenced by <code><ci></code> elements used within that 350 * expression. (In SBML Level 2 Version 1, there exists an 351 * attribute on Event called 'timeUnits'. This attribute can be used to set 352 * the units of the Delay expression explicitly.) The method 353 * Delay::getDerivedUnitDefinition() returns what libSBML computes the units 354 * to be, to the extent that libSBML can compute them. 355 * 356 * 357 * 358 * 359 * @note The functionality that facilitates unit analysis depends on the 360 * model as a whole. Thus, in cases where the object has not been added to 361 * a model or the model itself is incomplete, unit analysis is not possible 362 * and this method will return @c null. 363 * 364 * 365 * 366 * 367 * @warning <span class='warning'>Note that it is possible the 'math' 368 * expression in the Delay contains literal numbers or parameters with 369 * undeclared units. In those cases, it is not possible to calculate the 370 * units of the overall expression without making assumptions. LibSBML does 371 * not make assumptions about the units, and 372 * Delay::getDerivedUnitDefinition() only returns the units as far as it is 373 * able to determine them. For example, in an expression <em>X + Y</em>, if 374 * <em>X</em> has unambiguously-defined units and <em>Y</em> does not, it 375 * will return the units of <em>X</em>. When using this method, <strong>it 376 * is critical that callers also invoke the method</strong> 377 * Delay::containsUndeclaredUnits() <strong>to determine whether this 378 * situation holds</strong>. Callers should take suitable action in those 379 * situations.</span> 380 * 381 * 382 * @return a UnitDefinition that expresses the units of the math 383 * expression of this Delay, or @c null if one cannot be constructed. 384 * 385 * @see containsUndeclaredUnits() 386 */ public getDerivedUnitDefinition()387 UnitDefinition getDerivedUnitDefinition() { 388 global::System.IntPtr cPtr = libsbmlPINVOKE.Delay_getDerivedUnitDefinition__SWIG_0(swigCPtr); 389 UnitDefinition ret = (cPtr == global::System.IntPtr.Zero) ? null : new UnitDefinition(cPtr, false); 390 return ret; 391 } 392 393 394 /** 395 * Predicate returning @c true if the 'math' expression in this Delay 396 * instance contains parameters with undeclared units or literal numbers. 397 * 398 * 399 * 400 * Delay elements in SBML express a time delay for an Event. Beginning 401 * with SBML Level 2 Version 2, the units of that time are 402 * calculated based on the mathematical expression and the model quantities 403 * referenced by <code><ci></code> elements used within that 404 * expression. (In SBML Level 2 Version 1, there exists an 405 * attribute on Event called 'timeUnits'. This attribute can be used to set 406 * the units of the Delay expression explicitly.) The method 407 * Delay::getDerivedUnitDefinition() returns what libSBML computes the units 408 * to be, to the extent that libSBML can compute them. 409 * 410 * 411 * 412 * If the expression contains literal numbers or parameters with undeclared 413 * units, <strong>libSBML may not be able to compute the full units of the 414 * expression</strong> and will only return what it can compute. Callers 415 * should always use Delay::containsUndeclaredUnits() when using 416 * Delay::getDerivedUnitDefinition() to decide whether the returned units 417 * may be incomplete. 418 * 419 * @return @c true if the math expression of this Delay includes 420 * numbers/parameters with undeclared units, @c false otherwise. 421 * 422 * @note A return value of @c true indicates that the UnitDefinition 423 * returned by Delay::getDerivedUnitDefinition() may not accurately 424 * represent the units of the expression. 425 * 426 * @see getDerivedUnitDefinition() 427 */ public containsUndeclaredUnits()428 bool containsUndeclaredUnits() { 429 bool ret = libsbmlPINVOKE.Delay_containsUndeclaredUnits__SWIG_0(swigCPtr); 430 return ret; 431 } 432 433 434 /** 435 * Returns the libSBML type code of this object instance. 436 * 437 * 438 * 439 * LibSBML attaches an identifying code to every kind of SBML object. These 440 * are integer constants known as <em>SBML type codes</em>. The names of all 441 * the codes begin with the characters <code>SBML_</code>. 442 * @if clike The set of possible type codes for core elements is defined in 443 * the enumeration #SBMLTypeCode_t, and in addition, libSBML plug-ins for 444 * SBML Level 3 packages define their own extra enumerations of type 445 * codes (e.g., #SBMLLayoutTypeCode_t for the Level 3 Layout 446 * package).@endif@if java In the Java language interface for libSBML, the 447 * type codes are defined as static integer constants in the interface class 448 * {@link libsbmlConstants}. @endif@if python In the Python language 449 * interface for libSBML, the type codes are defined as static integer 450 * constants in the interface class @link libsbml@endlink.@endif@if csharp In 451 * the C# language interface for libSBML, the type codes are defined as 452 * static integer constants in the interface class 453 * @link libsbmlcs.libsbml@endlink.@endif Note that different Level 3 454 * package plug-ins may use overlapping type codes; to identify the package 455 * to which a given object belongs, call the 456 * <code>@if conly SBase_getPackageName() 457 * @else SBase::getPackageName() 458 * @endif</code> 459 * method on the object. 460 * 461 * The exception to this is lists: all SBML-style list elements have the type 462 * @link libsbml#SBML_LIST_OF SBML_LIST_OF@endlink, regardless of what package they 463 * are from. 464 * 465 * 466 * 467 * @return the SBML type code for this object: 468 * @link libsbml#SBML_DELAY SBML_DELAY@endlink (default). 469 * 470 * 471 * @warning <span class='warning'>The specific integer values of the possible 472 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 473 * packages, To fully identify the correct code, <strong>it is necessary to 474 * invoke both getPackageName() and getTypeCode()</strong> (or 475 * ListOf::getItemTypeCode()).</span> 476 * 477 * 478 * 479 * @see getElementName() 480 * @see getPackageName() 481 */ public new getTypeCode()482 int getTypeCode() { 483 int ret = libsbmlPINVOKE.Delay_getTypeCode(swigCPtr); 484 return ret; 485 } 486 487 488 /** 489 * Returns the XML element name of this object, which for Delay, is 490 * always @c 'delay'. 491 * 492 * @return the name of this element, i.e., @c 'delay'. 493 * 494 * @see getTypeCode() 495 */ public new getElementName()496 string getElementName() { 497 string ret = libsbmlPINVOKE.Delay_getElementName(swigCPtr); 498 return ret; 499 } 500 501 502 /** 503 * Predicate returning @c true if 504 * all the required elements for this Delay object 505 * have been set. 506 * 507 * @note The required elements for a Delay object are: 508 * @li 'math' inSBML Level 2 and Level 3 Version 1. 509 * (In SBML Level 3 Version 2+, it is no longer required.) 510 * 511 * @return a boolean value indicating whether all the required 512 * elements for this object have been defined. 513 */ public new hasRequiredElements()514 bool hasRequiredElements() { 515 bool ret = libsbmlPINVOKE.Delay_hasRequiredElements(swigCPtr); 516 return ret; 517 } 518 519 520 /** 521 * Finds this Delay's Event parent and calls unsetDelay() on it, indirectly 522 * deleting itself. 523 * 524 * Overridden from the SBase function since the parent is not a ListOf. 525 * 526 * 527 * @return integer value indicating success/failure of the 528 * function. @if clike The value is drawn from the 529 * enumeration #OperationReturnValues_t. @endif The possible values 530 * returned by this function are: 531 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 532 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 533 */ public new removeFromParentAndDelete()534 int removeFromParentAndDelete() { 535 int ret = libsbmlPINVOKE.Delay_removeFromParentAndDelete(swigCPtr); 536 return ret; 537 } 538 539 540 /** 541 * 542 * Replaces all uses of a given @c SIdRef type attribute value with another 543 * value. 544 * 545 * 546 * 547 548 * In SBML, object identifiers are of a data type called <code>SId</code>. 549 * In SBML Level 3, an explicit data type called <code>SIdRef</code> was 550 * introduced for attribute values that refer to <code>SId</code> values; in 551 * previous Levels of SBML, this data type did not exist and attributes were 552 * simply described to as 'referring to an identifier', but the effective 553 * data type was the same as <code>SIdRef</code> in Level 3. These and 554 * other methods of libSBML refer to the type <code>SIdRef</code> for all 555 * Levels of SBML, even if the corresponding SBML specification did not 556 * explicitly name the data type. 557 * 558 * 559 * 560 * This method works by looking at all attributes and (if appropriate) 561 * mathematical formulas in MathML content, comparing the referenced 562 * identifiers to the value of @p oldid. If any matches are found, the 563 * matching values are replaced with @p newid. The method does @em not 564 * descend into child elements. 565 * 566 * @param oldid the old identifier. 567 * @param newid the new identifier. 568 * 569 * 570 */ public new renameSIdRefs(string oldid, string newid)571 void renameSIdRefs(string oldid, string newid) { 572 libsbmlPINVOKE.Delay_renameSIdRefs(swigCPtr, oldid, newid); 573 } 574 575 576 /** 577 * 578 * Replaces all uses of a given @c UnitSIdRef type attribute value with 579 * another value. 580 * 581 * 582 * 583 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>. In 584 * SBML Level 3, an explicit data type called <code>UnitSIdRef</code> was 585 * introduced for attribute values that refer to <code>UnitSId</code> values; in 586 * previous Levels of SBML, this data type did not exist and attributes were 587 * simply described to as 'referring to a unit identifier', but the effective 588 * data type was the same as <code>UnitSIdRef</code> in Level 3. These and 589 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all 590 * Levels of SBML, even if the corresponding SBML specification did not 591 * explicitly name the data type. 592 * 593 * 594 * 595 * This method works by looking at all unit identifier attribute values 596 * (including, if appropriate, inside mathematical formulas), comparing the 597 * referenced unit identifiers to the value of @p oldid. If any matches 598 * are found, the matching values are replaced with @p newid. The method 599 * does @em not descend into child elements. 600 * 601 * @param oldid the old identifier. 602 * @param newid the new identifier. 603 * 604 * 605 */ public new renameUnitSIdRefs(string oldid, string newid)606 void renameUnitSIdRefs(string oldid, string newid) { 607 libsbmlPINVOKE.Delay_renameUnitSIdRefs(swigCPtr, oldid, newid); 608 } 609 610 611 /** */ /* libsbml-internal */ public new replaceSIDWithFunction(string id, ASTNode function)612 void replaceSIDWithFunction(string id, ASTNode function) { 613 libsbmlPINVOKE.Delay_replaceSIDWithFunction(swigCPtr, id, ASTNode.getCPtr(function)); 614 } 615 616 } 617 618 } 619