1 using System; 2 using System.Runtime.InteropServices; 3 4 //------------------------------------------------------------------------------ 5 // <auto-generated /> 6 // 7 // This file was automatically generated by SWIG (http://www.swig.org). 8 // Version 4.0.2 9 // 10 // Do not make changes to this file unless you know what you are doing--modify 11 // the SWIG interface file instead. 12 //------------------------------------------------------------------------------ 13 14 namespace libsbmlcs { 15 16 using System; 17 using System.Runtime.InteropServices; 18 19 /** 20 * @sbmlpackage{core} 21 * 22 @htmlinclude pkg-marker-core.html A user-defined function in an SBML model. 23 * 24 * The FunctionDefinition structure associates an identifier with a 25 * function definition. This identifier can then be used as the function 26 * called in subsequent MathML content elsewhere in an SBML model. 27 * 28 * FunctionDefinition has one required attribute, 'id', to give the 29 * function a unique identifier by which other parts of an SBML model 30 * definition can refer to it. A FunctionDefinition instance can also have 31 * an optional 'name' attribute of type @c string. Identifiers and names 32 * must be used according to the guidelines described in the %SBML 33 * specification (e.g., Section 3.3 in the Level 2 Version 4 34 * specification). 35 * 36 * FunctionDefinition has a 'math' subelement containing a MathML 37 * expression defining the function body. In SBML Level 2 and SBML 38 * Level 3 Version 1, that 'math' subelement is required; 39 * in SBML Level 3 Version 2, this restriction was relaxed, 40 * making the 'math' subelement optional. The content of this element can 41 * only be a MathML 'lambda' element. The 'lambda' element must begin with 42 * zero or more 'bvar' elements, followed by any other of the elements in 43 * the MathML subset allowed in SBML Level 2 @em except 'lambda' (i.e., a 44 * 'lambda' element cannot contain another 'lambda' element). This is the 45 * only place in SBML where a 'lambda' element can be used. The function 46 * defined by a FunctionDefinition is only available for use in other 47 * MathML elements that @em follow the FunctionDefinition definition in the 48 * model. (These restrictions prevent recursive and mutually-recursive 49 * functions from being expressed.) 50 * 51 * A further restriction on the content of 'math' is that it cannot contain 52 * references to variables other than the variables declared to the 53 * 'lambda' itself. That is, the contents of MathML 'ci' elements inside 54 * the body of the 'lambda' can only be the variables declared by its 55 * 'bvar' elements, or the identifiers of other FunctionDefinition 56 * instances in the model. This means must be written so that all 57 * variables or parameters used in the MathML content are passed to them 58 * via their function parameters. In SBML Level 2, this restriction 59 * applies also to the MathML @c csymbol elements for @em time and @em 60 * delay; in SBML Level 3, it additionally applies to the @c csymbol 61 * element for @em avogadro. 62 * 63 * In SBML Level 3 Version 2, if no math element is present in 64 * the FunctionDefinition, the function has no mathematical meaning 65 * defined in SBML Level 3 Core. This situation may arise when models 66 * are incomplete, or when additional meanings are provided by an SBML 67 * Level 3 package. 68 * 69 * @note Function definitions (also informally known as user-defined 70 * functions) were introduced in SBML Level 2. They have purposefully 71 * limited capabilities. A function cannot reference parameters or other 72 * model quantities outside of itself; values must be passed as parameters 73 * to the function. Moreover, recursive and mutually-recursive functions 74 * are not permitted. The purpose of these limitations is to balance power 75 * against complexity of implementation. With the restrictions as they 76 * are, function definitions could be implemented as textual 77 * substitutions---they are simply macros. Software implementations 78 * therefore do not need the full function-definition machinery typically 79 * associated with programming languages. 80 * <br><br> 81 * Another important point to note is FunctionDefinition does not 82 * have a separate attribute for defining the units of the value returned 83 * by the function. The units associated with the function's return value, 84 * when the function is called from within MathML expressions elsewhere in 85 * SBML, are simply the overall units of the expression in 86 * FunctionDefinition's 'math' subelement when applied to the arguments 87 * supplied in the call to the function. Ascertaining these units requires 88 * performing dimensional analysis on the expression. (Readers may wonder 89 * why there is no attribute. The reason is that having a separate 90 * attribute for declaring the units would not only be redundant, but also 91 * lead to the potential for having conflicting information. In the case 92 * of a conflict between the declared units and those of the value actually 93 * returned by the function, the only logical resolution rule would be to 94 * assume that the correct units are those of the expression anyway.) 95 * 96 * 97 * 98 */ 99 100 public class FunctionDefinition : SBase { 101 private HandleRef swigCPtr; 102 FunctionDefinition(IntPtr cPtr, bool cMemoryOwn)103 internal FunctionDefinition(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.FunctionDefinition_SWIGUpcast(cPtr), cMemoryOwn) 104 { 105 //super(libsbmlPINVOKE.FunctionDefinitionUpcast(cPtr), cMemoryOwn); 106 swigCPtr = new HandleRef(this, cPtr); 107 } 108 getCPtr(FunctionDefinition obj)109 internal static HandleRef getCPtr(FunctionDefinition obj) 110 { 111 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 112 } 113 getCPtrAndDisown(FunctionDefinition obj)114 internal static HandleRef getCPtrAndDisown (FunctionDefinition obj) 115 { 116 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 117 118 if (obj != null) 119 { 120 ptr = obj.swigCPtr; 121 obj.swigCMemOwn = false; 122 } 123 124 return ptr; 125 } 126 Dispose(bool disposing)127 protected override void Dispose(bool disposing) { 128 lock(this) { 129 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 130 if (swigCMemOwn) { 131 swigCMemOwn = false; 132 libsbmlPINVOKE.delete_FunctionDefinition(swigCPtr); 133 } 134 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 135 } 136 base.Dispose(disposing); 137 } 138 } 139 140 141 /** 142 * Creates a new FunctionDefinition using the given SBML @p level and @p version 143 * values. 144 * 145 * @param level a long integer, the SBML Level to assign to this FunctionDefinition. 146 * 147 * @param version a long integer, the SBML Version to assign to this 148 * FunctionDefinition. 149 * 150 * 151 * @throws SBMLConstructorException 152 * Thrown if the given @p level and @p version combination are invalid 153 * or if this object is incompatible with the given level and version. 154 * 155 * 156 * 157 * 158 * @note Attempting to add an object to an SBMLDocument having a different 159 * combination of SBML Level, Version and XML namespaces than the object 160 * itself will result in an error at the time a caller attempts to make the 161 * addition. A parent object must have compatible Level, Version and XML 162 * namespaces. (Strictly speaking, a parent may also have more XML 163 * namespaces than a child, but the reverse is not permitted.) The 164 * restriction is necessary to ensure that an SBML model has a consistent 165 * overall structure. This requires callers to manage their objects 166 * carefully, but the benefit is increased flexibility in how models can be 167 * created by permitting callers to create objects bottom-up if desired. In 168 * situations where objects are not yet attached to parents (e.g., 169 * SBMLDocument), knowledge of the intented SBML Level and Version help 170 * libSBML determine such things as whether it is valid to assign a 171 * particular value to an attribute. 172 * 173 * 174 */ public FunctionDefinition(long level, long version)175 FunctionDefinition(long level, long version) : this(libsbmlPINVOKE.new_FunctionDefinition__SWIG_0(level, version), true) { 176 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 177 } 178 179 180 /** 181 * Creates a new FunctionDefinition using the given SBMLNamespaces object 182 * @p sbmlns. 183 * 184 * 185 * 186 * The SBMLNamespaces object encapsulates SBML Level/Version/namespaces 187 * information. It is used to communicate the SBML Level, Version, and (in 188 * Level 3) packages used in addition to SBML Level 3 Core. A 189 * common approach to using libSBML's SBMLNamespaces facilities is to create an 190 * SBMLNamespaces object somewhere in a program once, then hand that object 191 * as needed to object constructors that accept SBMLNamespaces as arguments. 192 * 193 * 194 * 195 * @param sbmlns an SBMLNamespaces object. 196 * 197 * 198 * @throws SBMLConstructorException 199 * Thrown if the given @p sbmlns is inconsistent or incompatible 200 * with this object. 201 * 202 * 203 * 204 * 205 * @note Attempting to add an object to an SBMLDocument having a different 206 * combination of SBML Level, Version and XML namespaces than the object 207 * itself will result in an error at the time a caller attempts to make the 208 * addition. A parent object must have compatible Level, Version and XML 209 * namespaces. (Strictly speaking, a parent may also have more XML 210 * namespaces than a child, but the reverse is not permitted.) The 211 * restriction is necessary to ensure that an SBML model has a consistent 212 * overall structure. This requires callers to manage their objects 213 * carefully, but the benefit is increased flexibility in how models can be 214 * created by permitting callers to create objects bottom-up if desired. In 215 * situations where objects are not yet attached to parents (e.g., 216 * SBMLDocument), knowledge of the intented SBML Level and Version help 217 * libSBML determine such things as whether it is valid to assign a 218 * particular value to an attribute. 219 * 220 * 221 */ public FunctionDefinition(SBMLNamespaces sbmlns)222 FunctionDefinition(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_FunctionDefinition__SWIG_1(SBMLNamespaces.getCPtr(sbmlns)), true) { 223 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 224 } 225 226 227 /** 228 * Copy constructor; creates a copy of this FunctionDefinition. 229 * 230 * @param orig the object to copy. 231 */ public FunctionDefinition(FunctionDefinition orig)232 FunctionDefinition(FunctionDefinition orig) : this(libsbmlPINVOKE.new_FunctionDefinition__SWIG_2(FunctionDefinition.getCPtr(orig)), true) { 233 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 234 } 235 236 237 /** 238 * Creates and returns a deep copy of this FunctionDefinition object. 239 * 240 * @return the (deep) copy of this FunctionDefinition object. 241 */ public new clone()242 FunctionDefinition clone() { 243 global::System.IntPtr cPtr = libsbmlPINVOKE.FunctionDefinition_clone(swigCPtr); 244 FunctionDefinition ret = (cPtr == global::System.IntPtr.Zero) ? null : new FunctionDefinition(cPtr, true); 245 return ret; 246 } 247 248 249 /** 250 * Returns the value of the 'id' attribute of this FunctionDefinition. 251 * 252 * @note Because of the inconsistent behavior of this function with 253 * respect to assignments and rules, it is now recommended to 254 * use the getIdAttribute() function instead. 255 * 256 * 257 * 258 * The identifier given by an object's 'id' attribute value 259 * is used to identify the object within the SBML model definition. 260 * Other objects can refer to the component using this identifier. The 261 * data type of 'id' is always <code>SId</code> or a type derived 262 * from that, such as <code>UnitSId</code>, depending on the object in 263 * question. All data types are defined as follows: 264 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 265 * letter ::= 'a'..'z','A'..'Z' 266 * digit ::= '0'..'9' 267 * idChar ::= letter | digit | '_' 268 * SId ::= ( letter | '_' ) idChar* 269 * </pre> 270 * The characters <code>(</code> and <code>)</code> are used for grouping, 271 * the character <code>*</code> 'zero or more times', and the character 272 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers 273 * is determined by an exact character sequence match; i.e., comparisons must 274 * be performed in a case-sensitive manner. This applies to all uses of 275 * <code>SId</code>, <code>SIdRef</code>, and derived types. 276 * 277 * Users need to be aware of some important API issues that are the result of 278 * the history of SBML and libSBML. Prior to SBML Level 3 279 * Version 2, SBML defined 'id' and 'name' attributes on only a subset 280 * of SBML objects. To simplify the work of programmers, libSBML's API 281 * provided get, set, check, and unset on the SBase object class itself 282 * instead of on individual subobject classes. This made the 283 * get/set/etc. methods uniformly available on all objects in the libSBML 284 * API. LibSBML simply returned empty strings or otherwise did not act when 285 * the methods were applied to SBML objects that were not defined by the SBML 286 * specification to have 'id' or 'name' attributes. Additional complications 287 * arose with the rule and assignment objects: InitialAssignment, 288 * EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, 289 * the rule object hierarchy was different, and in addition, then as now, 290 * they possess different attributes: 'variable' (for the rules and event 291 * assignments), 'symbol' (for initial assignments), or neither (for 292 * algebraic rules). Prior to SBML Level 3 Version 2, getId() 293 * would always return an empty string, and isSetId() would always return @c 294 * false for objects of these classes. 295 * 296 * With the addition of 'id' and 'name' attributes on SBase in Level 3 297 * Version 2, it became necessary to introduce a new way to interact 298 * with the attributes more consistently in libSBML to avoid breaking 299 * backward compatibility in the behavior of the original 'id' methods. For 300 * this reason, libSBML provides four functions (getIdAttribute(), 301 * setIdAttribute(@if java String@endif), isSetIdAttribute(), and 302 * unsetIdAttribute()) that always act on the actual 'id' attribute inherited 303 * from SBase, regardless of the object's type. <strong>These new methods 304 * should be used instead of the older getId()/setId()/etc. methods</strong> 305 * unless the old behavior is somehow necessary. Regardless of the Level and 306 * Version of the SBML, these functions allow client applications to use more 307 * generalized code in some situations (for instance, when manipulating 308 * objects that are all known to have identifiers). If the object in 309 * question does not posess an 'id' attribute according to the SBML 310 * specification for the Level and Version in use, libSBML will not allow the 311 * identifier to be set, nor will it read or write 'id' attributes for those 312 * objects. 313 * 314 * 315 * 316 * @return the id of this FunctionDefinition. 317 * 318 * @see getIdAttribute() 319 * @see setIdAttribute(string sid) 320 * @see isSetIdAttribute() 321 * @see unsetIdAttribute() 322 */ public new getId()323 string getId() { 324 string ret = libsbmlPINVOKE.FunctionDefinition_getId(swigCPtr); 325 return ret; 326 } 327 328 329 /** 330 * Returns the value of the 'name' attribute of this FunctionDefinition object. 331 * 332 * 333 * 334 * 335 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 336 * moved to SBase directly, instead of being defined individually for many 337 * (but not all) objects. LibSBML has for a long time provided functions 338 * defined on SBase itself to get, set, and unset those attributes, which 339 * would fail or otherwise return empty strings if executed on any object 340 * for which those attributes were not defined. Now that all SBase objects 341 * define those attributes, those functions now succeed for any object with 342 * the appropriate level and version. 343 * 344 * The 'name' attribute is 345 * optional and is not intended to be used for cross-referencing purposes 346 * within a model. Its purpose instead is to provide a human-readable 347 * label for the component. The data type of 'name' is the type 348 * <code>string</code> defined in XML Schema. SBML imposes no 349 * restrictions as to the content of 'name' attributes beyond those 350 * restrictions defined by the <code>string</code> type in XML Schema. 351 * 352 * The recommended practice for handling 'name' is as follows. If a 353 * software tool has the capability for displaying the content of 'name' 354 * attributes, it should display this content to the user as a 355 * component's label instead of the component's 'id'. If the user 356 * interface does not have this capability (e.g., because it cannot 357 * display or use special characters in symbol names), or if the 'name' 358 * attribute is missing on a given component, then the user interface 359 * should display the value of the 'id' attribute instead. (Script 360 * language interpreters are especially likely to display 'id' instead of 361 * 'name'.) 362 * 363 * As a consequence of the above, authors of systems that automatically 364 * generate the values of 'id' attributes should be aware some systems 365 * may display the 'id''s to the user. Authors therefore may wish to 366 * take some care to have their software create 'id' values that are: (a) 367 * reasonably easy for humans to type and read; and (b) likely to be 368 * meaningful, for example by making the 'id' attribute be an abbreviated 369 * form of the name attribute value. 370 * 371 * An additional point worth mentioning is although there are 372 * restrictions on the uniqueness of 'id' values, there are no 373 * restrictions on the uniqueness of 'name' values in a model. This 374 * allows software applications leeway in assigning component identifiers. 375 * 376 * Regardless of the level and version of the SBML, these functions allow 377 * client applications to use more generalized code in some situations 378 * (for instance, when manipulating objects that are all known to have 379 * names). If the object in question does not posess a 'name' attribute 380 * according to the SBML specification for the Level and Version in use, 381 * libSBML will not allow the name to be set, nor will it read or 382 * write 'name' attributes for those objects. 383 * 384 * 385 * 386 * @return the name of this SBML object, or the empty string if not set or unsettable. 387 * 388 * @see getIdAttribute() 389 * @see isSetName() 390 * @see setName(string sid) 391 * @see unsetName() 392 * 393 * 394 */ public new getName()395 string getName() { 396 string ret = libsbmlPINVOKE.FunctionDefinition_getName(swigCPtr); 397 return ret; 398 } 399 400 401 /** 402 * Get the mathematical formula of this FunctionDefinition. 403 * 404 * @return an ASTNode, the value of the 'math' subelement of this 405 * FunctionDefinition, or @c null if the math is not set. 406 */ public new getMath()407 ASTNode getMath() { 408 global::System.IntPtr cPtr = libsbmlPINVOKE.FunctionDefinition_getMath(swigCPtr); 409 ASTNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new ASTNode(cPtr, false); 410 return ret; 411 } 412 413 414 /** 415 * Predicate returning @c true if this 416 * FunctionDefinition's 'id' attribute is set. 417 * 418 * 419 * 420 * 421 * The identifier given by an object's 'id' attribute value 422 * is used to identify the object within the SBML model definition. 423 * Other objects can refer to the component using this identifier. The 424 * data type of 'id' is always <code>SId</code> or a type derived 425 * from that, such as <code>UnitSId</code>, depending on the object in 426 * question. All data types are defined as follows: 427 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 428 * letter ::= 'a'..'z','A'..'Z' 429 * digit ::= '0'..'9' 430 * idChar ::= letter | digit | '_' 431 * SId ::= ( letter | '_' ) idChar* 432 * </pre> 433 * The characters <code>(</code> and <code>)</code> are used for grouping, 434 * the character <code>*</code> 'zero or more times', and the character 435 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers 436 * is determined by an exact character sequence match; i.e., comparisons must 437 * be performed in a case-sensitive manner. This applies to all uses of 438 * <code>SId</code>, <code>SIdRef</code>, and derived types. 439 * 440 * Users need to be aware of some important API issues that are the result of 441 * the history of SBML and libSBML. Prior to SBML Level 3 442 * Version 2, SBML defined 'id' and 'name' attributes on only a subset 443 * of SBML objects. To simplify the work of programmers, libSBML's API 444 * provided get, set, check, and unset on the SBase object class itself 445 * instead of on individual subobject classes. This made the 446 * get/set/etc. methods uniformly available on all objects in the libSBML 447 * API. LibSBML simply returned empty strings or otherwise did not act when 448 * the methods were applied to SBML objects that were not defined by the SBML 449 * specification to have 'id' or 'name' attributes. Additional complications 450 * arose with the rule and assignment objects: InitialAssignment, 451 * EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, 452 * the rule object hierarchy was different, and in addition, then as now, 453 * they possess different attributes: 'variable' (for the rules and event 454 * assignments), 'symbol' (for initial assignments), or neither (for 455 * algebraic rules). Prior to SBML Level 3 Version 2, getId() 456 * would always return an empty string, and isSetId() would always return @c 457 * false for objects of these classes. 458 * 459 * With the addition of 'id' and 'name' attributes on SBase in Level 3 460 * Version 2, it became necessary to introduce a new way to interact 461 * with the attributes more consistently in libSBML to avoid breaking 462 * backward compatibility in the behavior of the original 'id' methods. For 463 * this reason, libSBML provides four functions (getIdAttribute(), 464 * setIdAttribute(@if java String@endif), isSetIdAttribute(), and 465 * unsetIdAttribute()) that always act on the actual 'id' attribute inherited 466 * from SBase, regardless of the object's type. <strong>These new methods 467 * should be used instead of the older getId()/setId()/etc. methods</strong> 468 * unless the old behavior is somehow necessary. Regardless of the Level and 469 * Version of the SBML, these functions allow client applications to use more 470 * generalized code in some situations (for instance, when manipulating 471 * objects that are all known to have identifiers). If the object in 472 * question does not posess an 'id' attribute according to the SBML 473 * specification for the Level and Version in use, libSBML will not allow the 474 * identifier to be set, nor will it read or write 'id' attributes for those 475 * objects. 476 * 477 * 478 * 479 * @return @c true if the 'id' attribute of this SBML object is 480 * set, @c false otherwise. 481 * 482 * @note Because of the inconsistent behavior of this function with 483 * respect to assignments and rules, it is recommended that callers 484 * use isSetIdAttribute() instead. 485 * 486 * @see getIdAttribute() 487 * @see setIdAttribute(string sid) 488 * @see unsetIdAttribute() 489 * @see isSetIdAttribute() 490 * 491 * 492 */ public new isSetId()493 bool isSetId() { 494 bool ret = libsbmlPINVOKE.FunctionDefinition_isSetId(swigCPtr); 495 return ret; 496 } 497 498 499 /** 500 * Predicate returning @c true if this 501 * FunctionDefinition's 'name' attribute is set. 502 * 503 * 504 * 505 * 506 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 507 * moved to SBase directly, instead of being defined individually for many 508 * (but not all) objects. LibSBML has for a long time provided functions 509 * defined on SBase itself to get, set, and unset those attributes, which 510 * would fail or otherwise return empty strings if executed on any object 511 * for which those attributes were not defined. Now that all SBase objects 512 * define those attributes, those functions now succeed for any object with 513 * the appropriate level and version. 514 * 515 * The 'name' attribute is 516 * optional and is not intended to be used for cross-referencing purposes 517 * within a model. Its purpose instead is to provide a human-readable 518 * label for the component. The data type of 'name' is the type 519 * <code>string</code> defined in XML Schema. SBML imposes no 520 * restrictions as to the content of 'name' attributes beyond those 521 * restrictions defined by the <code>string</code> type in XML Schema. 522 * 523 * The recommended practice for handling 'name' is as follows. If a 524 * software tool has the capability for displaying the content of 'name' 525 * attributes, it should display this content to the user as a 526 * component's label instead of the component's 'id'. If the user 527 * interface does not have this capability (e.g., because it cannot 528 * display or use special characters in symbol names), or if the 'name' 529 * attribute is missing on a given component, then the user interface 530 * should display the value of the 'id' attribute instead. (Script 531 * language interpreters are especially likely to display 'id' instead of 532 * 'name'.) 533 * 534 * As a consequence of the above, authors of systems that automatically 535 * generate the values of 'id' attributes should be aware some systems 536 * may display the 'id''s to the user. Authors therefore may wish to 537 * take some care to have their software create 'id' values that are: (a) 538 * reasonably easy for humans to type and read; and (b) likely to be 539 * meaningful, for example by making the 'id' attribute be an abbreviated 540 * form of the name attribute value. 541 * 542 * An additional point worth mentioning is although there are 543 * restrictions on the uniqueness of 'id' values, there are no 544 * restrictions on the uniqueness of 'name' values in a model. This 545 * allows software applications leeway in assigning component identifiers. 546 * 547 * Regardless of the level and version of the SBML, these functions allow 548 * client applications to use more generalized code in some situations 549 * (for instance, when manipulating objects that are all known to have 550 * names). If the object in question does not posess a 'name' attribute 551 * according to the SBML specification for the Level and Version in use, 552 * libSBML will not allow the name to be set, nor will it read or 553 * write 'name' attributes for those objects. 554 * 555 * 556 * 557 * @return @c true if the 'name' attribute of this SBML object is 558 * set, @c false otherwise. 559 * 560 * @see getName() 561 * @see setName(string sid) 562 * @see unsetName() 563 * 564 * 565 */ public new isSetName()566 bool isSetName() { 567 bool ret = libsbmlPINVOKE.FunctionDefinition_isSetName(swigCPtr); 568 return ret; 569 } 570 571 572 /** 573 * Predicate returning @c true if this 574 * FunctionDefinition's 'math' subelement contains a value. 575 * 576 * @return @c true if the 'math' for this FunctionDefinition is set, 577 * @c false otherwise. 578 */ public isSetMath()579 bool isSetMath() { 580 bool ret = libsbmlPINVOKE.FunctionDefinition_isSetMath(swigCPtr); 581 return ret; 582 } 583 584 585 /** 586 * Sets the value of the 'id' attribute of this FunctionDefinition. 587 * 588 * 589 * 590 * The string @p sid is copied. 591 * 592 * 593 * 594 * The identifier given by an object's 'id' attribute value 595 * is used to identify the object within the SBML model definition. 596 * Other objects can refer to the component using this identifier. The 597 * data type of 'id' is always <code>SId</code> or a type derived 598 * from that, such as <code>UnitSId</code>, depending on the object in 599 * question. All data types are defined as follows: 600 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 601 * letter ::= 'a'..'z','A'..'Z' 602 * digit ::= '0'..'9' 603 * idChar ::= letter | digit | '_' 604 * SId ::= ( letter | '_' ) idChar* 605 * </pre> 606 * The characters <code>(</code> and <code>)</code> are used for grouping, 607 * the character <code>*</code> 'zero or more times', and the character 608 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers 609 * is determined by an exact character sequence match; i.e., comparisons must 610 * be performed in a case-sensitive manner. This applies to all uses of 611 * <code>SId</code>, <code>SIdRef</code>, and derived types. 612 * 613 * Users need to be aware of some important API issues that are the result of 614 * the history of SBML and libSBML. Prior to SBML Level 3 615 * Version 2, SBML defined 'id' and 'name' attributes on only a subset 616 * of SBML objects. To simplify the work of programmers, libSBML's API 617 * provided get, set, check, and unset on the SBase object class itself 618 * instead of on individual subobject classes. This made the 619 * get/set/etc. methods uniformly available on all objects in the libSBML 620 * API. LibSBML simply returned empty strings or otherwise did not act when 621 * the methods were applied to SBML objects that were not defined by the SBML 622 * specification to have 'id' or 'name' attributes. Additional complications 623 * arose with the rule and assignment objects: InitialAssignment, 624 * EventAssignment, AssignmentRule, and RateRule. In early versions of SBML, 625 * the rule object hierarchy was different, and in addition, then as now, 626 * they possess different attributes: 'variable' (for the rules and event 627 * assignments), 'symbol' (for initial assignments), or neither (for 628 * algebraic rules). Prior to SBML Level 3 Version 2, getId() 629 * would always return an empty string, and isSetId() would always return @c 630 * false for objects of these classes. 631 * 632 * With the addition of 'id' and 'name' attributes on SBase in Level 3 633 * Version 2, it became necessary to introduce a new way to interact 634 * with the attributes more consistently in libSBML to avoid breaking 635 * backward compatibility in the behavior of the original 'id' methods. For 636 * this reason, libSBML provides four functions (getIdAttribute(), 637 * setIdAttribute(@if java String@endif), isSetIdAttribute(), and 638 * unsetIdAttribute()) that always act on the actual 'id' attribute inherited 639 * from SBase, regardless of the object's type. <strong>These new methods 640 * should be used instead of the older getId()/setId()/etc. methods</strong> 641 * unless the old behavior is somehow necessary. Regardless of the Level and 642 * Version of the SBML, these functions allow client applications to use more 643 * generalized code in some situations (for instance, when manipulating 644 * objects that are all known to have identifiers). If the object in 645 * question does not posess an 'id' attribute according to the SBML 646 * specification for the Level and Version in use, libSBML will not allow the 647 * identifier to be set, nor will it read or write 'id' attributes for those 648 * objects. 649 * 650 * 651 * 652 * @param sid the string to use as the identifier of this object. 653 * 654 * 655 * @return integer value indicating success/failure of the 656 * function. @if clike The value is drawn from the 657 * enumeration #OperationReturnValues_t. @endif The possible values 658 * returned by this function are: 659 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 660 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 661 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 662 * 663 * @see getIdAttribute() 664 * @see setIdAttribute(string sid) 665 * @see isSetIdAttribute() 666 * @see unsetIdAttribute() 667 * 668 * 669 */ public new setId(string sid)670 int setId(string sid) { 671 int ret = libsbmlPINVOKE.FunctionDefinition_setId(swigCPtr, sid); 672 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 673 return ret; 674 } 675 676 677 /** 678 * Sets the value of the 'name' attribute of this FunctionDefinition. 679 * 680 * 681 * 682 * 683 * The string in @p name is copied. 684 * 685 * @param name the new name for the SBML object. 686 * 687 * 688 * @return integer value indicating success/failure of the 689 * function. @if clike The value is drawn from the 690 * enumeration #OperationReturnValues_t. @endif The possible values 691 * returned by this function are: 692 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 693 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 694 * 695 * 696 */ public new setName(string name)697 int setName(string name) { 698 int ret = libsbmlPINVOKE.FunctionDefinition_setName(swigCPtr, name); 699 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 700 return ret; 701 } 702 703 704 /** 705 * Sets the 'math' subelement of this FunctionDefinition to the Abstract 706 * Syntax Tree given in @p math. 707 * 708 * @param math an AST containing the mathematical expression to 709 * be used as the formula for this FunctionDefinition. 710 * 711 * 712 * @return integer value indicating success/failure of the 713 * function. @if clike The value is drawn from the 714 * enumeration #OperationReturnValues_t. @endif The possible values 715 * returned by this function are: 716 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 717 * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink 718 */ public new setMath(ASTNode math)719 int setMath(ASTNode math) { 720 int ret = libsbmlPINVOKE.FunctionDefinition_setMath(swigCPtr, ASTNode.getCPtr(math)); 721 return ret; 722 } 723 724 725 /** 726 * Unsets the value of the 'name' attribute of this FunctionDefinition. 727 * 728 * 729 * 730 * 731 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 732 * moved to SBase directly, instead of being defined individually for many 733 * (but not all) objects. LibSBML has for a long time provided functions 734 * defined on SBase itself to get, set, and unset those attributes, which 735 * would fail or otherwise return empty strings if executed on any object 736 * for which those attributes were not defined. Now that all SBase objects 737 * define those attributes, those functions now succeed for any object with 738 * the appropriate level and version. 739 * 740 * The 'name' attribute is 741 * optional and is not intended to be used for cross-referencing purposes 742 * within a model. Its purpose instead is to provide a human-readable 743 * label for the component. The data type of 'name' is the type 744 * <code>string</code> defined in XML Schema. SBML imposes no 745 * restrictions as to the content of 'name' attributes beyond those 746 * restrictions defined by the <code>string</code> type in XML Schema. 747 * 748 * The recommended practice for handling 'name' is as follows. If a 749 * software tool has the capability for displaying the content of 'name' 750 * attributes, it should display this content to the user as a 751 * component's label instead of the component's 'id'. If the user 752 * interface does not have this capability (e.g., because it cannot 753 * display or use special characters in symbol names), or if the 'name' 754 * attribute is missing on a given component, then the user interface 755 * should display the value of the 'id' attribute instead. (Script 756 * language interpreters are especially likely to display 'id' instead of 757 * 'name'.) 758 * 759 * As a consequence of the above, authors of systems that automatically 760 * generate the values of 'id' attributes should be aware some systems 761 * may display the 'id''s to the user. Authors therefore may wish to 762 * take some care to have their software create 'id' values that are: (a) 763 * reasonably easy for humans to type and read; and (b) likely to be 764 * meaningful, for example by making the 'id' attribute be an abbreviated 765 * form of the name attribute value. 766 * 767 * An additional point worth mentioning is although there are 768 * restrictions on the uniqueness of 'id' values, there are no 769 * restrictions on the uniqueness of 'name' values in a model. This 770 * allows software applications leeway in assigning component identifiers. 771 * 772 * Regardless of the level and version of the SBML, these functions allow 773 * client applications to use more generalized code in some situations 774 * (for instance, when manipulating objects that are all known to have 775 * names). If the object in question does not posess a 'name' attribute 776 * according to the SBML specification for the Level and Version in use, 777 * libSBML will not allow the name to be set, nor will it read or 778 * write 'name' attributes for those objects. 779 * 780 * 781 * 782 * 783 * @return integer value indicating success/failure of the 784 * function. @if clike The value is drawn from the 785 * enumeration #OperationReturnValues_t. @endif The possible values 786 * returned by this function are: 787 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 788 * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink 789 * 790 * @see getName() 791 * @see setName(string sid) 792 * @see isSetName() 793 * 794 * 795 */ public new unsetName()796 int unsetName() { 797 int ret = libsbmlPINVOKE.FunctionDefinition_unsetName(swigCPtr); 798 return ret; 799 } 800 801 802 /** 803 * Get the <code>n</code>th argument to this function. 804 * 805 * Callers should first find out the number of arguments to the function 806 * by calling getNumArguments(). 807 * 808 * @param n an integer index for the argument sought. 809 * 810 * @return the nth argument (bound variable) passed to this 811 * FunctionDefinition. 812 * If the index @p n is invalid, @c null is returned. 813 * 814 * @see getNumArguments() 815 */ public getArgument(long n)816 ASTNode getArgument(long n) { 817 global::System.IntPtr cPtr = libsbmlPINVOKE.FunctionDefinition_getArgument__SWIG_0(swigCPtr, n); 818 ASTNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new ASTNode(cPtr, false); 819 return ret; 820 } 821 822 823 /** 824 * Get the argument named @p name to this FunctionDefinition. 825 * 826 * @param name the exact name (case-sensitive) of the sought-after 827 * argument. 828 * 829 * @return the argument (bound variable) having the given name, or @c null if 830 * no such argument exists. 831 */ public getArgument(string name)832 ASTNode getArgument(string name) { 833 global::System.IntPtr cPtr = libsbmlPINVOKE.FunctionDefinition_getArgument__SWIG_1(swigCPtr, name); 834 ASTNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new ASTNode(cPtr, false); 835 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 836 return ret; 837 } 838 839 840 /** 841 * Get the mathematical expression that is the body of this 842 * FunctionDefinition object. 843 * 844 * @return the body of this FunctionDefinition as an Abstract Syntax 845 * Tree, or @c null if no body is defined. 846 */ public getBody()847 ASTNode getBody() { 848 global::System.IntPtr cPtr = libsbmlPINVOKE.FunctionDefinition_getBody__SWIG_0(swigCPtr); 849 ASTNode ret = (cPtr == global::System.IntPtr.Zero) ? null : new ASTNode(cPtr, false); 850 return ret; 851 } 852 853 854 /** 855 * Predicate returning @c true if the body of this 856 * FunctionDefinition has set. 857 * 858 * @return @c true if the body of this FunctionDefinition is 859 * set, @c false otherwise. 860 */ public isSetBody()861 bool isSetBody() { 862 bool ret = libsbmlPINVOKE.FunctionDefinition_isSetBody(swigCPtr); 863 return ret; 864 } 865 866 867 /** 868 * Get the number of arguments (bound variables) taken by this 869 * FunctionDefinition. 870 * 871 * @return the number of arguments (bound variables) that must be passed 872 * to this FunctionDefinition. 873 */ public getNumArguments()874 long getNumArguments() { return (long)libsbmlPINVOKE.FunctionDefinition_getNumArguments(swigCPtr); } 875 876 877 /** 878 * Returns the libSBML type code for this %SBML object. 879 * 880 * 881 * 882 * LibSBML attaches an identifying code to every kind of SBML object. These 883 * are integer constants known as <em>SBML type codes</em>. The names of all 884 * the codes begin with the characters <code>SBML_</code>. 885 * @if clike The set of possible type codes for core elements is defined in 886 * the enumeration #SBMLTypeCode_t, and in addition, libSBML plug-ins for 887 * SBML Level 3 packages define their own extra enumerations of type 888 * codes (e.g., #SBMLLayoutTypeCode_t for the Level 3 Layout 889 * package).@endif@if java In the Java language interface for libSBML, the 890 * type codes are defined as static integer constants in the interface class 891 * {@link libsbmlConstants}. @endif@if python In the Python language 892 * interface for libSBML, the type codes are defined as static integer 893 * constants in the interface class @link libsbml@endlink.@endif@if csharp In 894 * the C# language interface for libSBML, the type codes are defined as 895 * static integer constants in the interface class 896 * @link libsbmlcs.libsbml@endlink.@endif Note that different Level 3 897 * package plug-ins may use overlapping type codes; to identify the package 898 * to which a given object belongs, call the 899 * <code>@if conly SBase_getPackageName() 900 * @else SBase::getPackageName() 901 * @endif</code> 902 * method on the object. 903 * 904 * The exception to this is lists: all SBML-style list elements have the type 905 * @link libsbml#SBML_LIST_OF SBML_LIST_OF@endlink, regardless of what package they 906 * are from. 907 * 908 * 909 * 910 * @return the SBML type code for this object: 911 * @link libsbml#SBML_FUNCTION_DEFINITION SBML_FUNCTION_DEFINITION@endlink (default). 912 * 913 * 914 * @warning <span class='warning'>The specific integer values of the possible 915 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 916 * packages, To fully identify the correct code, <strong>it is necessary to 917 * invoke both getPackageName() and getTypeCode()</strong> (or 918 * ListOf::getItemTypeCode()).</span> 919 * 920 * 921 * 922 * @see getElementName() 923 * @see getPackageName() 924 */ public new getTypeCode()925 int getTypeCode() { 926 int ret = libsbmlPINVOKE.FunctionDefinition_getTypeCode(swigCPtr); 927 return ret; 928 } 929 930 931 /** 932 * Returns the XML element name of this object, which for 933 * FunctionDefinition, is always @c 'functionDefinition'. 934 * 935 * @return the name of this element, i.e., @c 'functionDefinition'. 936 */ public new getElementName()937 string getElementName() { 938 string ret = libsbmlPINVOKE.FunctionDefinition_getElementName(swigCPtr); 939 return ret; 940 } 941 942 943 /** 944 * Predicate returning @c true if 945 * all the required attributes for this FunctionDefinition object 946 * have been set. 947 * 948 * The required attributes for a FunctionDefinition object are: 949 * @li 'id' 950 * 951 * @return @c true if the required attributes have been set, @c false 952 * otherwise. 953 */ public new hasRequiredAttributes()954 bool hasRequiredAttributes() { 955 bool ret = libsbmlPINVOKE.FunctionDefinition_hasRequiredAttributes(swigCPtr); 956 return ret; 957 } 958 959 960 /** 961 * Predicate returning @c true if 962 * all the required elements for this FunctionDefinition object 963 * have been set. 964 * 965 * @note The required elements for a FunctionDefinition object are: 966 * @li 'math' inSBML Level 2 and Level 3 Version 1. 967 * (In SBML Level 3 Version 2+, it is no longer required.) 968 * 969 * @return a boolean value indicating whether all the required 970 * elements for this object have been defined. 971 */ public new hasRequiredElements()972 bool hasRequiredElements() { 973 bool ret = libsbmlPINVOKE.FunctionDefinition_hasRequiredElements(swigCPtr); 974 return ret; 975 } 976 977 978 /** 979 * Renames all the @c UnitSIdRef attributes on this element. 980 * 981 * 982 * 983 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>. In 984 * SBML Level 3, an explicit data type called <code>UnitSIdRef</code> was 985 * introduced for attribute values that refer to <code>UnitSId</code> values; in 986 * previous Levels of SBML, this data type did not exist and attributes were 987 * simply described to as 'referring to a unit identifier', but the effective 988 * data type was the same as <code>UnitSIdRef</code> in Level 3. These and 989 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all 990 * Levels of SBML, even if the corresponding SBML specification did not 991 * explicitly name the data type. 992 * 993 * 994 * 995 * This method works by looking at all unit identifier attribute values 996 * (including, if appropriate, inside mathematical formulas), comparing the 997 * unit identifiers to the value of @p oldid. If any matches are found, 998 * the matching identifiers are replaced with @p newid. The method does 999 * @em not descend into child elements. 1000 * 1001 * @param oldid the old identifier. 1002 * @param newid the new identifier. 1003 */ public new renameUnitSIdRefs(string oldid, string newid)1004 void renameUnitSIdRefs(string oldid, string newid) { 1005 libsbmlPINVOKE.FunctionDefinition_renameUnitSIdRefs(swigCPtr, oldid, newid); 1006 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 1007 } 1008 1009 } 1010 1011 } 1012