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 single unit referenced in an SBML <em>unit definition</em>. 20 * 21 * The SBML unit definition facility uses two classes of objects, 22 * UnitDefinition and Unit. The approach to defining units in %SBML is 23 * compositional; for example, <em>meter second<sup> –2</sup></em> is 24 * constructed by combining a Unit object representing <em>meter</em> with 25 * another Unit object representing <em>second<sup> –2</sup></em>. 26 * The combination is wrapped inside a UnitDefinition, which provides for 27 * assigning an identifier and optional name to the combination. The 28 * identifier can then be referenced from elsewhere in a model. Thus, the 29 * UnitDefinition class is the container, and Unit instances are placed 30 * inside UnitDefinition instances. 31 * 32 * A Unit has four attributes named 'kind', 'exponent', 'scale' 33 * and 'multiplier'. It represents a (possibly transformed) reference to a 34 * base unit. The attribute 'kind' on Unit indicates the chosen base unit. 35 * Its value must be one of the text strings listed below; this list 36 * corresponds to SBML Level 3: 37 * 38 * 39 * 40 <table border='0' class='centered text-table width80 normal-font code' 41 style='border: none !important'> 42 <tr> 43 <td>ampere</td><td>farad</td><td>joule</td><td>lux</td><td>radian</td><td>volt</td> 44 </tr> 45 <tr> 46 <td>avogadro</td><td>gram</td><td>katal</td><td>metre</td><td>second</td><td>watt</td> 47 </tr> 48 <tr> 49 <td>becquerel</td><td>gray</td><td>kelvin</td><td>mole</td><td>siemens</td><td>weber</td> 50 </tr> 51 <tr> 52 <td>candela</td><td>henry</td><td>kilogram</td><td>newton</td><td>sievert</td> 53 </tr> 54 <tr> 55 <td>coulomb</td><td>hertz</td><td>litre</td><td>ohm</td><td>steradian</td> 56 </tr> 57 <tr> 58 <td>dimensionless</td><td>item</td><td>lumen</td><td>pascal</td><td>tesla</td> 59 </tr> 60 </table> 61 * 62 * 63 * 64 * A few small differences exist between the Level 3 list of base 65 * units and the list defined in other Level/Version combinations of SBML. 66 * Specifically, Levels of SBML before Level 3 do not define 67 * @c avogadro; conversely, Level 2 Version 1 defines @c Celsius, 68 * and Level 1 defines @c celsius, @c meter, and @c liter, none of 69 * which are available in Level 3. In libSBML, each of the predefined 70 * base unit names is represented by an enumeration value @if clike in 71 * #UnitKind_t@else whose name begins with the characters 72 * <code>UNIT_KIND_</code>@endif, discussed in a separate section below. 73 * 74 * The attribute named 'exponent' on Unit represents an exponent on the 75 * unit. In SBML Level 2, the attribute is optional and has a default 76 * value of @c 1 (one); in SBML Level 3, the attribute is mandatory 77 * and there is no default value. A Unit also has an attribute 78 * called 'scale'; its value must be an integer exponent for a power-of-ten 79 * multiplier used to set the scale of the unit. For example, a unit 80 * having a 'kind' value of @c gram and a 'scale' value of @c -3 signifies 81 * 10<sup> –3</sup> * gram, or milligrams. In SBML 82 * Level 2, the attribute is optional and has a default value of @c 0 83 * (zero), because 10<sup> 0</sup> = 1; in SBML Level 3, the attribute 84 * is mandatory and has no default value. Lastly, the attribute named 85 * 'multiplier' can be used to multiply the unit by a real-numbered factor; 86 * this enables the definition of units that are not power-of-ten multiples 87 * of SI units. For instance, a multiplier of 0.3048 could be used to 88 * define @c foot as a measure of length in terms of a @c metre. The 89 * 'multiplier' attribute is optional in SBML Level 2, where it has a 90 * default value of @c 1 (one); in SBML Level 3, the attribute is 91 * mandatory and has no default value. 92 * 93 * @if clike 94 * <h3><a class='anchor' name='UnitKind_t'>UnitKind_t</a></h3> 95 * @else 96 * <h3><a class='anchor' name='UnitKind_t'>%Unit identification codes</a></h3> 97 * @endif 98 * 99 * As discussed above, SBML defines a set of base units which serves as the 100 * starting point for new unit definitions. This set of base units 101 * consists of the SI units and a small number of additional convenience 102 * units. 103 * 104 * @if clike Until SBML Level 2 Version 3, there 105 * existed a data type in the SBML specifications called @c UnitKind, 106 * enumerating the possible SBML base units. Although SBML Level 2 107 * Version 3 removed this type from the language specification, 108 * libSBML maintains the corresponding enumeration type #UnitKind_t as a 109 * convenience and as a way to provide backward compatibility to previous 110 * SBML Level/Version specifications. (The removal in SBML Level 2 111 * Version 3 of the enumeration @c UnitKind was also accompanied by 112 * the redefinition of the data type @c UnitSId to include the previous 113 * @c UnitKind values as reserved symbols in the @c UnitSId space. This 114 * change has no net effect on permissible models, their representation or 115 * their syntax. The purpose of the change in the SBML specification was 116 * simply to clean up an inconsistency about the contexts in which these 117 * values were usable.) 118 * @endif@if java In SBML Level 2 Versions before 119 * Version 3, there existed an enumeration of units called 120 * @c UnitKind. In Version 3, this enumeration was removed and the 121 * identifier class @c UnitSId redefined to include the previous 122 * @c UnitKind values as reserved symbols. This change has no net effect on 123 * permissible models, their representation or their syntax. The purpose 124 * of the change in the SBML specification was simply to clean up an 125 * inconsistency about the contexts in which these values were usable. 126 * However, libSBML maintains UnitKind in the form of of a set of static 127 * integer constants whose names begin with the characters 128 * <code>UNIT_KIND_</code>. These constants are defined in the class 129 * <code><a href='libsbml.libsbml.html'>libsbmlConstants</a></code>. 130 * @endif@if python In SBML Level 2 Versions before 131 * Version 3, there existed an enumeration of units called 132 * @c UnitKind. In Version 3, this enumeration was removed and the 133 * identifier class @c UnitSId redefined to include the previous 134 * @c UnitKind values as reserved symbols. This change has no net effect on 135 * permissible models, their representation or their syntax. The purpose 136 * of the change in the SBML specification was simply to clean up an 137 * inconsistency about the contexts in which these values were usable. 138 * However, libSBML maintains UnitKind in the form of of a set of static 139 * integer constants whose names begin with the characters 140 * <code>UNIT_KIND_</code>. These constants are defined in the class 141 * @link libsbml libsbml@endlink. 142 * @endif 143 * 144 * As a consequence of the fact that libSBML supports models in all Levels 145 * and Versions of SBML, libSBML's set of @c UNIT_KIND_ values is a union 146 * of all the possible base unit names defined in the different SBML 147 * specifications. However, not every base unit is allowed in every 148 * Level+Version combination of SBML. Note in particular the following 149 * exceptions: 150 * <ul> 151 * <li> The alternate spelling @c 'meter' is included in 152 * addition to the official SI spelling @c 'metre'. This spelling is only 153 * permitted in SBML Level 1 models. 154 * 155 * <li> The alternate spelling @c 'liter' is included in addition to the 156 * official SI spelling @c 'litre'. This spelling is only permitted in 157 * SBML Level 1 models. 158 * 159 * <li> The unit @c 'Celsius' is included because of its presence in 160 * specifications of SBML prior to SBML Level 2 Version 2. 161 * 162 * <li> The unit @c avogadro was introduced in SBML Level 3, and 163 * is only permitted for use in SBML Level 3 models. 164 * </ul> 165 * 166 * @if clike The table below lists the symbols defined in the 167 * @c UnitKind_t enumeration, and their 168 * meanings. @else The table below lists the unit 169 * constants defined in libSBML, and their meanings. @endif 170 * 171 * @htmlinclude unitkind-table.html 172 * 173 * 174 */ 175 176 public class Unit : SBase { 177 private HandleRef swigCPtr; 178 Unit(IntPtr cPtr, bool cMemoryOwn)179 internal Unit(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.Unit_SWIGUpcast(cPtr), cMemoryOwn) 180 { 181 //super(libsbmlPINVOKE.UnitUpcast(cPtr), cMemoryOwn); 182 swigCPtr = new HandleRef(this, cPtr); 183 } 184 getCPtr(Unit obj)185 internal static HandleRef getCPtr(Unit obj) 186 { 187 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 188 } 189 getCPtrAndDisown(Unit obj)190 internal static HandleRef getCPtrAndDisown (Unit obj) 191 { 192 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 193 194 if (obj != null) 195 { 196 ptr = obj.swigCPtr; 197 obj.swigCMemOwn = false; 198 } 199 200 return ptr; 201 } 202 Dispose(bool disposing)203 protected override void Dispose(bool disposing) { 204 lock(this) { 205 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 206 if (swigCMemOwn) { 207 swigCMemOwn = false; 208 libsbmlPINVOKE.delete_Unit(swigCPtr); 209 } 210 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 211 } 212 base.Dispose(disposing); 213 } 214 } 215 216 217 /** 218 * Creates a new Unit using the given SBML @p level and @p version 219 * values. 220 * 221 * @param level a long integer, the SBML Level to assign to this Unit. 222 * 223 * @param version a long integer, the SBML Version to assign to this 224 * Unit. 225 * 226 * 227 * @throws SBMLConstructorException 228 * Thrown if the given @p level and @p version combination are invalid 229 * or if this object is incompatible with the given level and version. 230 * 231 * 232 * 233 * 234 * @note Attempting to add an object to an SBMLDocument having a different 235 * combination of SBML Level, Version and XML namespaces than the object 236 * itself will result in an error at the time a caller attempts to make the 237 * addition. A parent object must have compatible Level, Version and XML 238 * namespaces. (Strictly speaking, a parent may also have more XML 239 * namespaces than a child, but the reverse is not permitted.) The 240 * restriction is necessary to ensure that an SBML model has a consistent 241 * overall structure. This requires callers to manage their objects 242 * carefully, but the benefit is increased flexibility in how models can be 243 * created by permitting callers to create objects bottom-up if desired. In 244 * situations where objects are not yet attached to parents (e.g., 245 * SBMLDocument), knowledge of the intented SBML Level and Version help 246 * libSBML determine such things as whether it is valid to assign a 247 * particular value to an attribute. 248 * 249 * 250 */ public Unit(long level, long version)251 Unit(long level, long version) : this(libsbmlPINVOKE.new_Unit__SWIG_0(level, version), true) { 252 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 253 } 254 255 256 /** 257 * Creates a new Unit using the given SBMLNamespaces object 258 * @p sbmlns. 259 * 260 * 261 * 262 * The SBMLNamespaces object encapsulates SBML Level/Version/namespaces 263 * information. It is used to communicate the SBML Level, Version, and (in 264 * Level 3) packages used in addition to SBML Level 3 Core. A 265 * common approach to using libSBML's SBMLNamespaces facilities is to create an 266 * SBMLNamespaces object somewhere in a program once, then hand that object 267 * as needed to object constructors that accept SBMLNamespaces as arguments. 268 * 269 * 270 * 271 * @param sbmlns an SBMLNamespaces object. 272 * 273 * 274 * @throws SBMLConstructorException 275 * Thrown if the given @p sbmlns is inconsistent or incompatible 276 * with this object. 277 * 278 * 279 * 280 * 281 * @note Attempting to add an object to an SBMLDocument having a different 282 * combination of SBML Level, Version and XML namespaces than the object 283 * itself will result in an error at the time a caller attempts to make the 284 * addition. A parent object must have compatible Level, Version and XML 285 * namespaces. (Strictly speaking, a parent may also have more XML 286 * namespaces than a child, but the reverse is not permitted.) The 287 * restriction is necessary to ensure that an SBML model has a consistent 288 * overall structure. This requires callers to manage their objects 289 * carefully, but the benefit is increased flexibility in how models can be 290 * created by permitting callers to create objects bottom-up if desired. In 291 * situations where objects are not yet attached to parents (e.g., 292 * SBMLDocument), knowledge of the intented SBML Level and Version help 293 * libSBML determine such things as whether it is valid to assign a 294 * particular value to an attribute. 295 * 296 * 297 */ public Unit(SBMLNamespaces sbmlns)298 Unit(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_Unit__SWIG_1(SBMLNamespaces.getCPtr(sbmlns)), true) { 299 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 300 } 301 302 303 /** 304 * Copy constructor; creates a copy of this Unit. 305 * 306 * @param orig the object to copy. 307 */ public Unit(Unit orig)308 Unit(Unit orig) : this(libsbmlPINVOKE.new_Unit__SWIG_2(Unit.getCPtr(orig)), true) { 309 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 310 } 311 312 313 /** 314 * Creates and returns a deep copy of this Unit object. 315 * 316 * @return the (deep) copy of this Unit object. 317 */ public new clone()318 Unit clone() { 319 global::System.IntPtr cPtr = libsbmlPINVOKE.Unit_clone(swigCPtr); 320 Unit ret = (cPtr == global::System.IntPtr.Zero) ? null : new Unit(cPtr, true); 321 return ret; 322 } 323 324 325 /** 326 * Initializes the fields of this Unit object to 'typical' default 327 * values. 328 * 329 * The SBML Unit component has slightly different aspects and default 330 * attribute values in different SBML Levels and Versions. This method 331 * sets the values to certain common defaults, based mostly on what they 332 * are in SBML Level 2. Specifically: 333 * <ul> 334 * <li> Sets attribute 'exponent' to @c 1 335 * <li> Sets attribute 'scale' to @c 0 336 * <li> Sets attribute 'multiplier' to @c 1.0 337 * </ul> 338 * 339 * The 'kind' attribute is left unchanged. 340 */ public initDefaults()341 void initDefaults() { 342 libsbmlPINVOKE.Unit_initDefaults(swigCPtr); 343 } 344 345 346 /** 347 * Returns the 'kind' of Unit this is. 348 * 349 * @if clike 350 * @return the value of the 'kind' attribute of this Unit as a 351 * value from the <a class='el' href='#UnitKind_t'>UnitKind_t</a> enumeration. 352 * @endif@if java 353 * @return the value of the 'kind' attribute of this Unit as a 354 * value from the set of constants whose names begin 355 * with <code>UNIT_KIND_</code> defined in the class 356 * <code><a href='libsbml.libsbml.html'>libsbmlConstants</a></code>. 357 * @endif@if python 358 * @return the value of the 'kind' attribute of this Unit as a 359 * value from the set of constants whose names begin 360 * with <code>UNIT_KIND_</code> defined in the class 361 * @link libsbml libsbml@endlink. 362 * @endif 363 */ public getKind()364 int getKind() { 365 int ret = libsbmlPINVOKE.Unit_getKind(swigCPtr); 366 return ret; 367 } 368 369 370 /** 371 * Returns the value of the 'exponent' attribute of this unit. 372 * 373 * @return the 'exponent' value of this Unit, as an integer. 374 */ public getExponent()375 int getExponent() { 376 int ret = libsbmlPINVOKE.Unit_getExponent(swigCPtr); 377 return ret; 378 } 379 380 381 /** 382 * Returns the value of the 'exponent' attribute of this unit. 383 * 384 * @return the 'exponent' value of this Unit, as a double. 385 */ public getExponentAsDouble()386 double getExponentAsDouble() { 387 double ret = libsbmlPINVOKE.Unit_getExponentAsDouble(swigCPtr); 388 return ret; 389 } 390 391 392 /** 393 * Returns the value of the 'scale' attribute of this unit. 394 * 395 * @return the 'scale' value of this Unit, as an integer. 396 */ public getScale()397 int getScale() { 398 int ret = libsbmlPINVOKE.Unit_getScale(swigCPtr); 399 return ret; 400 } 401 402 403 /** 404 * Returns the value of the 'multiplier' attribute of this Unit. 405 * 406 * @return the 'multiplier' value of this Unit, as a double. 407 */ public getMultiplier()408 double getMultiplier() { 409 double ret = libsbmlPINVOKE.Unit_getMultiplier(swigCPtr); 410 return ret; 411 } 412 413 414 /** 415 * Returns the value of the 'offset' attribute of this Unit. 416 * 417 * @return the 'offset' value of this Unit, as a double. 418 * 419 * 420 * @warning <span class='warning'>The 'offset' attribute is only available in 421 * SBML Level 2 Version 1. This attribute is not present in SBML 422 * Level 2 Version 2 or above. When producing SBML models using 423 * these later specifications, modelers and software tools need to account 424 * for units with offsets explicitly. The %SBML specification document 425 * offers a number of suggestions for how to achieve this. LibSBML methods 426 * such as this one related to 'offset' are retained for compatibility with 427 * earlier versions of SBML Level 2, but their use is strongly 428 * discouraged.</span> 429 * 430 */ public getOffset()431 double getOffset() { 432 double ret = libsbmlPINVOKE.Unit_getOffset(swigCPtr); 433 return ret; 434 } 435 436 437 /** 438 * Predicate for testing whether this Unit is of the kind @c ampere. 439 * 440 * @return @c true if the kind of this Unit is @c ampere, @c false 441 * otherwise. 442 */ public isAmpere()443 bool isAmpere() { 444 bool ret = libsbmlPINVOKE.Unit_isAmpere(swigCPtr); 445 return ret; 446 } 447 448 449 /** 450 * Predicate for testing whether this Unit is of the kind @c avogadro. 451 * 452 * @return @c true if the kind of this Unit is @c avogadro, @c false 453 * otherwise. 454 * 455 * @note The unit @c avogadro was introduced in SBML Level 3, and 456 * is only permitted for use in SBML Level 3 models. 457 */ public isAvogadro()458 bool isAvogadro() { 459 bool ret = libsbmlPINVOKE.Unit_isAvogadro(swigCPtr); 460 return ret; 461 } 462 463 464 /** 465 * Predicate for testing whether this Unit is of the kind @c becquerel 466 * 467 * @return @c true if the kind of this Unit is @c becquerel, @c false 468 * otherwise. 469 */ public isBecquerel()470 bool isBecquerel() { 471 bool ret = libsbmlPINVOKE.Unit_isBecquerel(swigCPtr); 472 return ret; 473 } 474 475 476 /** 477 * Predicate for testing whether this Unit is of the kind @c candela 478 * 479 * @return @c true if the kind of this Unit is @c candela, @c false 480 * otherwise. 481 */ public isCandela()482 bool isCandela() { 483 bool ret = libsbmlPINVOKE.Unit_isCandela(swigCPtr); 484 return ret; 485 } 486 487 488 /** 489 * Predicate for testing whether this Unit is of the kind @c Celsius 490 * 491 * @return @c true if the kind of this Unit is @c Celsius, @c false 492 * otherwise. 493 * 494 * @warning <span class='warning'>The predefined unit @c Celsius was 495 * removed from the list of predefined units in SBML Level 2 496 * Version 2 at the same time that the 'offset' attribute was removed 497 * from Unit definitions. LibSBML methods such as this one related to 498 * @c Celsius are retained in order to support SBML Level 2 499 * Version 1, but their use is strongly discouraged.</span> 500 */ public isCelsius()501 bool isCelsius() { 502 bool ret = libsbmlPINVOKE.Unit_isCelsius(swigCPtr); 503 return ret; 504 } 505 506 507 /** 508 * Predicate for testing whether this Unit is of the kind @c coulomb 509 * 510 * @return @c true if the kind of this Unit is @c coulomb, @c false 511 * otherwise. 512 */ public isCoulomb()513 bool isCoulomb() { 514 bool ret = libsbmlPINVOKE.Unit_isCoulomb(swigCPtr); 515 return ret; 516 } 517 518 519 /** 520 * Predicate for testing whether this Unit is of the kind 521 * @c dimensionless. 522 * 523 * @return @c true if the kind of this Unit is @c dimensionless, @c false 524 * otherwise. 525 */ public isDimensionless()526 bool isDimensionless() { 527 bool ret = libsbmlPINVOKE.Unit_isDimensionless(swigCPtr); 528 return ret; 529 } 530 531 532 /** 533 * Predicate for testing whether this Unit is of the kind @c farad 534 * 535 * @return @c true if the kind of this Unit is @c farad, @c false 536 * otherwise. 537 */ public isFarad()538 bool isFarad() { 539 bool ret = libsbmlPINVOKE.Unit_isFarad(swigCPtr); 540 return ret; 541 } 542 543 544 /** 545 * Predicate for testing whether this Unit is of the kind @c gram 546 * 547 * @return @c true if the kind of this Unit is @c gram, @c false 548 * otherwise. 549 */ public isGram()550 bool isGram() { 551 bool ret = libsbmlPINVOKE.Unit_isGram(swigCPtr); 552 return ret; 553 } 554 555 556 /** 557 * Predicate for testing whether this Unit is of the kind @c gray 558 * 559 * @return @c true if the kind of this Unit is @c gray, @c false 560 * otherwise. 561 */ public isGray()562 bool isGray() { 563 bool ret = libsbmlPINVOKE.Unit_isGray(swigCPtr); 564 return ret; 565 } 566 567 568 /** 569 * Predicate for testing whether this Unit is of the kind @c henry 570 * 571 * @return @c true if the kind of this Unit is @c henry, @c false 572 * otherwise. 573 */ public isHenry()574 bool isHenry() { 575 bool ret = libsbmlPINVOKE.Unit_isHenry(swigCPtr); 576 return ret; 577 } 578 579 580 /** 581 * Predicate for testing whether this Unit is of the kind @c hertz 582 * 583 * @return @c true if the kind of this Unit is @c hertz, @c false 584 * otherwise. 585 */ public isHertz()586 bool isHertz() { 587 bool ret = libsbmlPINVOKE.Unit_isHertz(swigCPtr); 588 return ret; 589 } 590 591 592 /** 593 * Predicate for testing whether this Unit is of the kind @c item 594 * 595 * @return @c true if the kind of this Unit is @c item, @c false 596 * otherwise. 597 */ public isItem()598 bool isItem() { 599 bool ret = libsbmlPINVOKE.Unit_isItem(swigCPtr); 600 return ret; 601 } 602 603 604 /** 605 * Predicate for testing whether this Unit is of the kind @c joule 606 * 607 * @return @c true if the kind of this Unit is @c joule, @c false 608 * otherwise. 609 */ public isJoule()610 bool isJoule() { 611 bool ret = libsbmlPINVOKE.Unit_isJoule(swigCPtr); 612 return ret; 613 } 614 615 616 /** 617 * Predicate for testing whether this Unit is of the kind @c katal 618 * 619 * @return @c true if the kind of this Unit is @c katal, @c false 620 * otherwise. 621 */ public isKatal()622 bool isKatal() { 623 bool ret = libsbmlPINVOKE.Unit_isKatal(swigCPtr); 624 return ret; 625 } 626 627 628 /** 629 * Predicate for testing whether this Unit is of the kind @c kelvin 630 * 631 * @return @c true if the kind of this Unit is @c kelvin, @c false 632 * otherwise. 633 */ public isKelvin()634 bool isKelvin() { 635 bool ret = libsbmlPINVOKE.Unit_isKelvin(swigCPtr); 636 return ret; 637 } 638 639 640 /** 641 * Predicate for testing whether this Unit is of the kind @c kilogram 642 * 643 * @return @c true if the kind of this Unit is @c kilogram, @c false 644 * otherwise. 645 */ public isKilogram()646 bool isKilogram() { 647 bool ret = libsbmlPINVOKE.Unit_isKilogram(swigCPtr); 648 return ret; 649 } 650 651 652 /** 653 * Predicate for testing whether this Unit is of the kind @c litre 654 * 655 * @return @c true if the kind of this Unit is @c litre or 'liter', 656 * @c false otherwise. 657 */ public isLitre()658 bool isLitre() { 659 bool ret = libsbmlPINVOKE.Unit_isLitre(swigCPtr); 660 return ret; 661 } 662 663 664 /** 665 * Predicate for testing whether this Unit is of the kind @c lumen 666 * 667 * @return @c true if the kind of this Unit is @c lumen, @c false 668 * otherwise. 669 */ public isLumen()670 bool isLumen() { 671 bool ret = libsbmlPINVOKE.Unit_isLumen(swigCPtr); 672 return ret; 673 } 674 675 676 /** 677 * Predicate for testing whether this Unit is of the kind @c lux 678 * 679 * @return @c true if the kind of this Unit is @c lux, @c false 680 * otherwise. 681 */ public isLux()682 bool isLux() { 683 bool ret = libsbmlPINVOKE.Unit_isLux(swigCPtr); 684 return ret; 685 } 686 687 688 /** 689 * Predicate for testing whether this Unit is of the kind @c metre 690 * 691 * @return @c true if the kind of this Unit is @c metre or 'meter', 692 * @c false 693 * otherwise. 694 */ public isMetre()695 bool isMetre() { 696 bool ret = libsbmlPINVOKE.Unit_isMetre(swigCPtr); 697 return ret; 698 } 699 700 701 /** 702 * Predicate for testing whether this Unit is of the kind @c mole 703 * 704 * @return @c true if the kind of this Unit is @c mole, @c false 705 * otherwise. 706 */ public isMole()707 bool isMole() { 708 bool ret = libsbmlPINVOKE.Unit_isMole(swigCPtr); 709 return ret; 710 } 711 712 713 /** 714 * Predicate for testing whether this Unit is of the kind @c newton 715 * 716 * @return @c true if the kind of this Unit is @c newton, @c false 717 * otherwise. 718 */ public isNewton()719 bool isNewton() { 720 bool ret = libsbmlPINVOKE.Unit_isNewton(swigCPtr); 721 return ret; 722 } 723 724 725 /** 726 * Predicate for testing whether this Unit is of the kind @c ohm 727 * 728 * @return @c true if the kind of this Unit is @c ohm, @c false 729 * otherwise. 730 */ public isOhm()731 bool isOhm() { 732 bool ret = libsbmlPINVOKE.Unit_isOhm(swigCPtr); 733 return ret; 734 } 735 736 737 /** 738 * Predicate for testing whether this Unit is of the kind @c pascal 739 * 740 * @return @c true if the kind of this Unit is @c pascal, @c false 741 * otherwise. 742 */ public isPascal()743 bool isPascal() { 744 bool ret = libsbmlPINVOKE.Unit_isPascal(swigCPtr); 745 return ret; 746 } 747 748 749 /** 750 * Predicate for testing whether this Unit is of the kind @c radian 751 * 752 * @return @c true if the kind of this Unit is @c radian, @c false 753 * otherwise. 754 */ public isRadian()755 bool isRadian() { 756 bool ret = libsbmlPINVOKE.Unit_isRadian(swigCPtr); 757 return ret; 758 } 759 760 761 /** 762 * Predicate for testing whether this Unit is of the kind @c second 763 * 764 * @return @c true if the kind of this Unit is @c second, @c false 765 * otherwise. 766 */ public isSecond()767 bool isSecond() { 768 bool ret = libsbmlPINVOKE.Unit_isSecond(swigCPtr); 769 return ret; 770 } 771 772 773 /** 774 * Predicate for testing whether this Unit is of the kind @c siemens 775 * 776 * @return @c true if the kind of this Unit is @c siemens, @c false 777 * otherwise. 778 */ public isSiemens()779 bool isSiemens() { 780 bool ret = libsbmlPINVOKE.Unit_isSiemens(swigCPtr); 781 return ret; 782 } 783 784 785 /** 786 * Predicate for testing whether this Unit is of the kind @c sievert 787 * 788 * @return @c true if the kind of this Unit is @c sievert, @c false 789 * otherwise. 790 */ public isSievert()791 bool isSievert() { 792 bool ret = libsbmlPINVOKE.Unit_isSievert(swigCPtr); 793 return ret; 794 } 795 796 797 /** 798 * Predicate for testing whether this Unit is of the kind @c steradian 799 * 800 * @return @c true if the kind of this Unit is @c steradian, @c false 801 * otherwise. 802 */ public isSteradian()803 bool isSteradian() { 804 bool ret = libsbmlPINVOKE.Unit_isSteradian(swigCPtr); 805 return ret; 806 } 807 808 809 /** 810 * Predicate for testing whether this Unit is of the kind @c tesla 811 * 812 * @return @c true if the kind of this Unit is @c tesla, @c false 813 * otherwise. 814 */ public isTesla()815 bool isTesla() { 816 bool ret = libsbmlPINVOKE.Unit_isTesla(swigCPtr); 817 return ret; 818 } 819 820 821 /** 822 * Predicate for testing whether this Unit is of the kind @c volt 823 * 824 * @return @c true if the kind of this Unit is @c volt, @c false 825 * otherwise. 826 */ public isVolt()827 bool isVolt() { 828 bool ret = libsbmlPINVOKE.Unit_isVolt(swigCPtr); 829 return ret; 830 } 831 832 833 /** 834 * Predicate for testing whether this Unit is of the kind @c watt 835 * 836 * @return @c true if the kind of this Unit is @c watt, @c false 837 * otherwise. 838 */ public isWatt()839 bool isWatt() { 840 bool ret = libsbmlPINVOKE.Unit_isWatt(swigCPtr); 841 return ret; 842 } 843 844 845 /** 846 * Predicate for testing whether this Unit is of the kind @c weber 847 * 848 * @return @c true if the kind of this Unit is @c weber, @c false 849 * otherwise. 850 */ public isWeber()851 bool isWeber() { 852 bool ret = libsbmlPINVOKE.Unit_isWeber(swigCPtr); 853 return ret; 854 } 855 856 857 /** 858 * Predicate to test whether the 'kind' attribute of this Unit is set. 859 * 860 * @return @c true if the 'kind' attribute of this Unit is set, 861 * @c false otherwise. 862 */ public isSetKind()863 bool isSetKind() { 864 bool ret = libsbmlPINVOKE.Unit_isSetKind(swigCPtr); 865 return ret; 866 } 867 868 869 /** 870 * Predicate to test whether the 'exponent' attribute of this Unit 871 * is set. 872 * 873 * @return @c true if the 'exponent' attribute of this Unit is set, 874 * @c false otherwise. 875 */ public isSetExponent()876 bool isSetExponent() { 877 bool ret = libsbmlPINVOKE.Unit_isSetExponent(swigCPtr); 878 return ret; 879 } 880 881 882 /** 883 * Predicate to test whether the 'scale' attribute of this Unit 884 * is set. 885 * 886 * @return @c true if the 'scale' attribute of this Unit is set, 887 * @c false otherwise. 888 */ public isSetScale()889 bool isSetScale() { 890 bool ret = libsbmlPINVOKE.Unit_isSetScale(swigCPtr); 891 return ret; 892 } 893 894 895 /** 896 * Predicate to test whether the 'multiplier' attribute of this Unit 897 * is set. 898 * 899 * @return @c true if the 'multiplier' attribute of this Unit is set, 900 * @c false otherwise. 901 */ public isSetMultiplier()902 bool isSetMultiplier() { 903 bool ret = libsbmlPINVOKE.Unit_isSetMultiplier(swigCPtr); 904 return ret; 905 } 906 907 908 /** 909 * Predicate to test whether the 'offset' attribute of this Unit 910 * is set. 911 * 912 * @return @c true if the 'offset' attribute of this Unit is set, 913 * @c false otherwise. 914 * 915 * 916 * @warning <span class='warning'>The 'offset' attribute is only available in 917 * SBML Level 2 Version 1. This attribute is not present in SBML 918 * Level 2 Version 2 or above. When producing SBML models using 919 * these later specifications, modelers and software tools need to account 920 * for units with offsets explicitly. The %SBML specification document 921 * offers a number of suggestions for how to achieve this. LibSBML methods 922 * such as this one related to 'offset' are retained for compatibility with 923 * earlier versions of SBML Level 2, but their use is strongly 924 * discouraged.</span> 925 * 926 */ public isSetOffset()927 bool isSetOffset() { 928 bool ret = libsbmlPINVOKE.Unit_isSetOffset(swigCPtr); 929 return ret; 930 } 931 932 933 /** 934 * Sets the 'kind' attribute value of this Unit. 935 * 936 * @if clike 937 * @param kind a value from the <a class='el' 938 * href='#UnitKind_t'>UnitKind_t</a> enumeration. 939 * @endif@if java 940 * @param kind a unit identifier chosen from the set of constants whose 941 * names begin with <code>UNIT_KIND_</code> in <code><a 942 * href='libsbml.libsbml.html'>libsbmlConstants</a></code>. 943 * @endif@if python 944 * @param kind a unit identifier chosen from the set of constants whose 945 * names begin with <code>UNIT_KIND_</code> in @link libsbml libsbml@endlink. 946 * @endif 947 * 948 * 949 * @return integer value indicating success/failure of the 950 * function. @if clike The value is drawn from the 951 * enumeration #OperationReturnValues_t. @endif The possible values 952 * returned by this function are: 953 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 954 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 955 */ public setKind(int kind)956 int setKind(int kind) { 957 int ret = libsbmlPINVOKE.Unit_setKind(swigCPtr, kind); 958 return ret; 959 } 960 961 962 /** 963 * Sets the 'exponent' attribute value of this Unit. 964 * 965 * @param value the integer to which the attribute 'exponent' should be set. 966 * 967 * 968 * @return integer value indicating success/failure of the 969 * function. @if clike The value is drawn from the 970 * enumeration #OperationReturnValues_t. @endif The possible values 971 * returned by this function are: 972 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 973 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 974 */ public setExponent(int value)975 int setExponent(int value) { 976 int ret = libsbmlPINVOKE.Unit_setExponent__SWIG_0(swigCPtr, value); 977 return ret; 978 } 979 980 981 /** 982 * Sets the 'exponent' attribute value of this Unit. 983 * 984 * @param value the double to which the attribute 'exponent' should be set. 985 * 986 * 987 * @return integer value indicating success/failure of the 988 * function. @if clike The value is drawn from the 989 * enumeration #OperationReturnValues_t. @endif The possible values 990 * returned by this function are: 991 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 992 */ public setExponent(double value)993 int setExponent(double value) { 994 int ret = libsbmlPINVOKE.Unit_setExponent__SWIG_1(swigCPtr, value); 995 return ret; 996 } 997 998 999 /** 1000 * Sets the 'scale' attribute value of this Unit. 1001 * 1002 * @param value the integer to which the attribute 'scale' should be set. 1003 * 1004 * 1005 * @return integer value indicating success/failure of the 1006 * function. @if clike The value is drawn from the 1007 * enumeration #OperationReturnValues_t. @endif The possible values 1008 * returned by this function are: 1009 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1010 */ public setScale(int value)1011 int setScale(int value) { 1012 int ret = libsbmlPINVOKE.Unit_setScale(swigCPtr, value); 1013 return ret; 1014 } 1015 1016 1017 /** 1018 * Sets the 'multipler' attribute value of this Unit. 1019 * 1020 * @param value the floating-point value to which the attribute 1021 * 'multiplier' should be set. 1022 * 1023 * 1024 * @return integer value indicating success/failure of the 1025 * function. @if clike The value is drawn from the 1026 * enumeration #OperationReturnValues_t. @endif The possible values 1027 * returned by this function are: 1028 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1029 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 1030 */ public setMultiplier(double value)1031 int setMultiplier(double value) { 1032 int ret = libsbmlPINVOKE.Unit_setMultiplier(swigCPtr, value); 1033 return ret; 1034 } 1035 1036 1037 /** 1038 * Sets the 'offset' attribute value of this Unit. 1039 * 1040 * @param value the floating point value to which the attribute 'offset' 1041 * should set. 1042 * 1043 * 1044 * @return integer value indicating success/failure of the 1045 * function. @if clike The value is drawn from the 1046 * enumeration #OperationReturnValues_t. @endif The possible values 1047 * returned by this function are: 1048 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1049 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 1050 * 1051 * 1052 * @warning <span class='warning'>The 'offset' attribute is only available in 1053 * SBML Level 2 Version 1. This attribute is not present in SBML 1054 * Level 2 Version 2 or above. When producing SBML models using 1055 * these later specifications, modelers and software tools need to account 1056 * for units with offsets explicitly. The %SBML specification document 1057 * offers a number of suggestions for how to achieve this. LibSBML methods 1058 * such as this one related to 'offset' are retained for compatibility with 1059 * earlier versions of SBML Level 2, but their use is strongly 1060 * discouraged.</span> 1061 * 1062 */ public setOffset(double value)1063 int setOffset(double value) { 1064 int ret = libsbmlPINVOKE.Unit_setOffset(swigCPtr, value); 1065 return ret; 1066 } 1067 1068 1069 /** 1070 * Unsets the 'kind' attribute value of this Unit. 1071 * 1072 * 1073 * @return integer value indicating success/failure of the 1074 * function. @if clike The value is drawn from the 1075 * enumeration #OperationReturnValues_t. @endif The possible values 1076 * returned by this function are: 1077 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1078 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 1079 */ public unsetKind()1080 int unsetKind() { 1081 int ret = libsbmlPINVOKE.Unit_unsetKind(swigCPtr); 1082 return ret; 1083 } 1084 1085 1086 /** 1087 * Unsets the 'exponent' attribute value of this Unit. 1088 * 1089 * 1090 * @return integer value indicating success/failure of the 1091 * function. @if clike The value is drawn from the 1092 * enumeration #OperationReturnValues_t. @endif The possible values 1093 * returned by this function are: 1094 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1095 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 1096 */ public unsetExponent()1097 int unsetExponent() { 1098 int ret = libsbmlPINVOKE.Unit_unsetExponent(swigCPtr); 1099 return ret; 1100 } 1101 1102 1103 /** 1104 * Unsets the 'scale' attribute value of this Unit. 1105 * 1106 * 1107 * @return integer value indicating success/failure of the 1108 * function. @if clike The value is drawn from the 1109 * enumeration #OperationReturnValues_t. @endif The possible values 1110 * returned by this function are: 1111 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1112 */ public unsetScale()1113 int unsetScale() { 1114 int ret = libsbmlPINVOKE.Unit_unsetScale(swigCPtr); 1115 return ret; 1116 } 1117 1118 1119 /** 1120 * Unsets the 'multipler' attribute value of this Unit. 1121 * 1122 * 1123 * @return integer value indicating success/failure of the 1124 * function. @if clike The value is drawn from the 1125 * enumeration #OperationReturnValues_t. @endif The possible values 1126 * returned by this function are: 1127 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1128 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 1129 */ public unsetMultiplier()1130 int unsetMultiplier() { 1131 int ret = libsbmlPINVOKE.Unit_unsetMultiplier(swigCPtr); 1132 return ret; 1133 } 1134 1135 1136 /** 1137 * Unsets the 'offset' attribute value of this Unit. 1138 * 1139 * 1140 * @return integer value indicating success/failure of the 1141 * function. @if clike The value is drawn from the 1142 * enumeration #OperationReturnValues_t. @endif The possible values 1143 * returned by this function are: 1144 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1145 * @li @link libsbml#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink 1146 * 1147 * 1148 * @warning <span class='warning'>The 'offset' attribute is only available in 1149 * SBML Level 2 Version 1. This attribute is not present in SBML 1150 * Level 2 Version 2 or above. When producing SBML models using 1151 * these later specifications, modelers and software tools need to account 1152 * for units with offsets explicitly. The %SBML specification document 1153 * offers a number of suggestions for how to achieve this. LibSBML methods 1154 * such as this one related to 'offset' are retained for compatibility with 1155 * earlier versions of SBML Level 2, but their use is strongly 1156 * discouraged.</span> 1157 * 1158 */ public unsetOffset()1159 int unsetOffset() { 1160 int ret = libsbmlPINVOKE.Unit_unsetOffset(swigCPtr); 1161 return ret; 1162 } 1163 1164 1165 /** 1166 * Returns the libSBML type code of this object instance. 1167 * 1168 * 1169 * 1170 * LibSBML attaches an identifying code to every kind of SBML object. These 1171 * are integer constants known as <em>SBML type codes</em>. The names of all 1172 * the codes begin with the characters <code>SBML_</code>. 1173 * @if clike The set of possible type codes for core elements is defined in 1174 * the enumeration #SBMLTypeCode_t, and in addition, libSBML plug-ins for 1175 * SBML Level 3 packages define their own extra enumerations of type 1176 * codes (e.g., #SBMLLayoutTypeCode_t for the Level 3 Layout 1177 * package).@endif@if java In the Java language interface for libSBML, the 1178 * type codes are defined as static integer constants in the interface class 1179 * {@link libsbmlConstants}. @endif@if python In the Python language 1180 * interface for libSBML, the type codes are defined as static integer 1181 * constants in the interface class @link libsbml@endlink.@endif@if csharp In 1182 * the C# language interface for libSBML, the type codes are defined as 1183 * static integer constants in the interface class 1184 * @link libsbmlcs.libsbml@endlink.@endif Note that different Level 3 1185 * package plug-ins may use overlapping type codes; to identify the package 1186 * to which a given object belongs, call the 1187 * <code>@if conly SBase_getPackageName() 1188 * @else SBase::getPackageName() 1189 * @endif</code> 1190 * method on the object. 1191 * 1192 * The exception to this is lists: all SBML-style list elements have the type 1193 * @link libsbml#SBML_LIST_OF SBML_LIST_OF@endlink, regardless of what package they 1194 * are from. 1195 * 1196 * 1197 * 1198 * @return the SBML type code for this object: 1199 * @link libsbml#SBML_UNIT SBML_UNIT@endlink (default). 1200 * 1201 * 1202 * @warning <span class='warning'>The specific integer values of the possible 1203 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 1204 * packages, To fully identify the correct code, <strong>it is necessary to 1205 * invoke both getPackageName() and getTypeCode()</strong> (or 1206 * ListOf::getItemTypeCode()).</span> 1207 * 1208 * 1209 * 1210 * @see getPackageName() 1211 * @see getElementName() 1212 */ public new getTypeCode()1213 int getTypeCode() { 1214 int ret = libsbmlPINVOKE.Unit_getTypeCode(swigCPtr); 1215 return ret; 1216 } 1217 1218 1219 /** 1220 * Returns the XML element name of this object, which for Unit, is 1221 * always @c 'unit'. 1222 * 1223 * @return the name of this element, i.e., @c 'unit'. 1224 */ public new getElementName()1225 string getElementName() { 1226 string ret = libsbmlPINVOKE.Unit_getElementName(swigCPtr); 1227 return ret; 1228 } 1229 1230 1231 /** 1232 * Predicate to test whether a given string is the name of a built-in SBML 1233 * unit, depending on the SBML level, since new predefined units were added 1234 * between level 2 versions 1 and 2, and then all predefined units were removed 1235 * again in SBML Level 3. 1236 * 1237 * @param name a string to be tested against the built-in unit names. 1238 * @param level the level of SBML one is checking. 1239 * 1240 * @return @c true if @p name is one of @c 'substance', @c 'volume', 1241 * or @c 'time' and the @p level is @c 1; or if @p name is one of 1242 * @c 'substance', @c 'volume', @c 'area', @c 'length', or @c 'time' and 1243 * the @p level is @c 2; @c false otherwise (including all values when 1244 * @p level is @c 3). 1245 * 1246 * 1247 * 1248 * @if python @note Because this is a static method on a class, the Python 1249 * language interface for libSBML will contain two variants. One will be the 1250 * expected, normal static method on the class (i.e., a regular 1251 * <em>methodName</em>), and the other will be a standalone top-level 1252 * function with the name <em>ClassName_methodName()</em>. This is merely an 1253 * artifact of how the language interfaces are created in libSBML. The 1254 * methods are functionally identical. @endif 1255 * 1256 * 1257 */ public isBuiltIn(string name, long level)1258 static bool isBuiltIn(string name, long level) { 1259 bool ret = libsbmlPINVOKE.Unit_isBuiltIn(name, level); 1260 return ret; 1261 } 1262 1263 1264 /** 1265 * Predicate to test whether a given string is the name of a valid 1266 * base unit in SBML (such as @c 'gram' or @c 'mole'). 1267 * 1268 * This method exists because prior to SBML Level 2 Version 3, 1269 * an enumeration called @c UnitKind was defined by SBML. This enumeration 1270 * was removed in SBML Level 2 Version 3 and its values were 1271 * folded into the space of values of a type called @c UnitSId. This method 1272 * therefore has less significance in SBML Level 2 Version 3 1273 * and Level 2 Version 4, but remains for backward 1274 * compatibility and support for reading models in older Versions of 1275 * Level 2. 1276 * 1277 * @param name a string to be tested. 1278 * 1279 * @param level a long integer representing the SBML specification 1280 * Level. 1281 * 1282 * @param version a long integer representing the SBML specification 1283 * Version. 1284 * 1285 * @return @c true if name is a valid SBML UnitKind, @c false otherwise. 1286 * 1287 * @note The allowed unit names differ between SBML Levels 1 1288 * and 2 and again slightly between Level 2 Versions 1 1289 * and 2. 1290 * 1291 * 1292 * @if python @note Because this is a static method on a class, the Python 1293 * language interface for libSBML will contain two variants. One will be the 1294 * expected, normal static method on the class (i.e., a regular 1295 * <em>methodName</em>), and the other will be a standalone top-level 1296 * function with the name <em>ClassName_methodName()</em>. This is merely an 1297 * artifact of how the language interfaces are created in libSBML. The 1298 * methods are functionally identical. @endif 1299 * 1300 * 1301 */ public isUnitKind(string name, long level, long version)1302 static bool isUnitKind(string name, long level, long version) { 1303 bool ret = libsbmlPINVOKE.Unit_isUnitKind(name, level, version); 1304 return ret; 1305 } 1306 1307 1308 /** 1309 * Predicate returning @c true if two 1310 * Unit objects are identical. 1311 * 1312 * Two Unit objects are considered to be @em identical if they match in 1313 * all attributes. (Contrast this to the method areEquivalent(@if java 1314 * Unit u1, %Unit u2@endif), which compares Unit objects only with respect 1315 * to certain attributes.) 1316 * 1317 * @param unit1 the first Unit object to compare. 1318 * @param unit2 the second Unit object to compare. 1319 * 1320 * @return @c true if all the attributes of unit1 are identical 1321 * to the attributes of unit2, @c false otherwise. 1322 * 1323 * 1324 * @if python @note Because this is a static method on a class, the Python 1325 * language interface for libSBML will contain two variants. One will be the 1326 * expected, normal static method on the class (i.e., a regular 1327 * <em>methodName</em>), and the other will be a standalone top-level 1328 * function with the name <em>ClassName_methodName()</em>. This is merely an 1329 * artifact of how the language interfaces are created in libSBML. The 1330 * methods are functionally identical. @endif 1331 * 1332 * 1333 * 1334 * @see @if clike areEquivalent() @else Unit::areEquivalent(Unit u1, %Unit u2) @endif 1335 */ public areIdentical(Unit unit1, Unit unit2)1336 static bool areIdentical(Unit unit1, Unit unit2) { 1337 bool ret = libsbmlPINVOKE.Unit_areIdentical(Unit.getCPtr(unit1), Unit.getCPtr(unit2)); 1338 return ret; 1339 } 1340 1341 1342 /** 1343 * Predicate returning @c true if 1344 * Unit objects are equivalent. 1345 * 1346 * Two Unit objects are considered to be @em equivalent either if (1) both 1347 * have a 'kind' attribute value of @c dimensionless, or (2) their 'kind', 1348 * 'exponent' and (for SBML Level 2 Version 1) 'offset' 1349 * attribute values are equal. (Contrast this to the method 1350 * areIdentical(@if java Unit, %Unit@endif), which compares Unit objects with respect to all 1351 * attributes, not just the 'kind' and 'exponent'.) 1352 * 1353 * @param unit1 the first Unit object to compare. 1354 * @param unit2 the second Unit object to compare. 1355 * 1356 * @return @c true if the 'kind' and 'exponent' attributes of unit1 are 1357 * identical to the kind and exponent attributes of unit2, or if the kind 1358 * attributes of both are @c dimensionless; @c false otherwise. 1359 * 1360 * 1361 * @if python @note Because this is a static method on a class, the Python 1362 * language interface for libSBML will contain two variants. One will be the 1363 * expected, normal static method on the class (i.e., a regular 1364 * <em>methodName</em>), and the other will be a standalone top-level 1365 * function with the name <em>ClassName_methodName()</em>. This is merely an 1366 * artifact of how the language interfaces are created in libSBML. The 1367 * methods are functionally identical. @endif 1368 * 1369 * 1370 * 1371 * @see @if clike areIdentical() @else Unit::areIdentical(Unit u1, %Unit u2) @endif 1372 */ public areEquivalent(Unit unit1, Unit unit2)1373 static bool areEquivalent(Unit unit1, Unit unit2) { 1374 bool ret = libsbmlPINVOKE.Unit_areEquivalent(Unit.getCPtr(unit1), Unit.getCPtr(unit2)); 1375 return ret; 1376 } 1377 1378 1379 /** 1380 * Manipulates the attributes of the Unit to express the unit with the 1381 * value of the scale attribute reduced to zero. 1382 * 1383 * For example, 1 millimetre can be expressed as a Unit with kind= 1384 * @c 'metre' multiplier=@c '1' scale=@c '-3' exponent=@c '1'. It can also be 1385 * expressed as a Unit with kind=@c 'metre' 1386 * multiplier=<code>'0.001'</code> scale=@c '0' exponent=@c '1'. 1387 * 1388 * @param unit the Unit object to manipulate. 1389 * 1390 * 1391 * @return integer value indicating success/failure of the 1392 * function. @if clike The value is drawn from the 1393 * enumeration #OperationReturnValues_t. @endif This particular 1394 * function only does one thing irrespective of user input or 1395 * object state, and thus will only return a single value: 1396 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 1397 * 1398 * 1399 * @if python @note Because this is a static method on a class, the Python 1400 * language interface for libSBML will contain two variants. One will be the 1401 * expected, normal static method on the class (i.e., a regular 1402 * <em>methodName</em>), and the other will be a standalone top-level 1403 * function with the name <em>ClassName_methodName()</em>. This is merely an 1404 * artifact of how the language interfaces are created in libSBML. The 1405 * methods are functionally identical. @endif 1406 * 1407 * 1408 * 1409 * @see @if clike convertToSI() @else Unit::convertToSI(Unit u) @endif 1410 * @see @if clike merge() @else Unit::merge(Unit u1, Unit u2) @endif 1411 */ public removeScale(Unit unit)1412 static int removeScale(Unit unit) { 1413 int ret = libsbmlPINVOKE.Unit_removeScale(Unit.getCPtr(unit)); 1414 return ret; 1415 } 1416 1417 1418 /** 1419 * Merges two Unit objects with the same 'kind' attribute value into a 1420 * single Unit. 1421 * 1422 * For example, the following, 1423 * @verbatim 1424 <unit kind='metre' exponent='2'/> 1425 <unit kind='metre' exponent='1'/> 1426 @endverbatim 1427 * would be merged to become 1428 * @verbatim 1429 <unit kind='metre' exponent='3'/> 1430 @endverbatim 1431 * 1432 * @param unit1 the first Unit object; the result of the operation is 1433 * left as a new version of this unit, modified in-place. Not modified if 1434 * the two units have different kinds. 1435 * 1436 * @param unit2 the second Unit object to merge with the first. 1437 * 1438 * 1439 * @if python @note Because this is a static method on a class, the Python 1440 * language interface for libSBML will contain two variants. One will be the 1441 * expected, normal static method on the class (i.e., a regular 1442 * <em>methodName</em>), and the other will be a standalone top-level 1443 * function with the name <em>ClassName_methodName()</em>. This is merely an 1444 * artifact of how the language interfaces are created in libSBML. The 1445 * methods are functionally identical. @endif 1446 * 1447 * 1448 * 1449 * @see @if clike convertToSI() @else Unit::convertToSI(Unit u) @endif 1450 * @see @if clike removeScale() @else Unit::removeScale(Unit u) @endif 1451 */ public merge(Unit unit1, Unit unit2)1452 static void merge(Unit unit1, Unit unit2) { 1453 libsbmlPINVOKE.Unit_merge(Unit.getCPtr(unit1), Unit.getCPtr(unit2)); 1454 } 1455 1456 1457 /** 1458 * Returns a UnitDefinition object containing the given @p unit converted 1459 * to the appropriate SI unit. 1460 * 1461 * This method exists because some units can be expressed in terms of 1462 * others when the same physical dimension is involved. For example, one 1463 * hertz is identical to 1 sec<sup>-1</sup>, one litre is equivalent 1464 * to 1 cubic decametre, and so on. 1465 * 1466 * @param unit the Unit object to convert to SI. 1467 * 1468 * @return a UnitDefinition object containing the SI unit. 1469 * 1470 * 1471 * @if python @note Because this is a static method on a class, the Python 1472 * language interface for libSBML will contain two variants. One will be the 1473 * expected, normal static method on the class (i.e., a regular 1474 * <em>methodName</em>), and the other will be a standalone top-level 1475 * function with the name <em>ClassName_methodName()</em>. This is merely an 1476 * artifact of how the language interfaces are created in libSBML. The 1477 * methods are functionally identical. @endif 1478 * 1479 * 1480 * 1481 * @see @if clike merge() @else Unit::merge(Unit u1, Unit u2) @endif 1482 */ public convertToSI(Unit unit)1483 static UnitDefinition convertToSI(Unit unit) { 1484 global::System.IntPtr cPtr = libsbmlPINVOKE.Unit_convertToSI(Unit.getCPtr(unit)); 1485 UnitDefinition ret = (cPtr == global::System.IntPtr.Zero) ? null : new UnitDefinition(cPtr, true); 1486 return ret; 1487 } 1488 1489 1490 /** 1491 * Predicate returning @c true if 1492 * all the required attributes for this Unit object 1493 * have been set. 1494 * 1495 * The required attributes for a Unit object are: 1496 * @li 'kind' 1497 * @li 'exponent' (required in SBML Level 3; optional in Level 2) 1498 * @li 'multiplier' (required in SBML Level 3; optional in Level 2) 1499 * @li 'scale' (required in SBML Level 3; optional in Level 2) 1500 * 1501 * @return @c true if the required attributes have been set, @c false 1502 * otherwise. 1503 */ public new hasRequiredAttributes()1504 bool hasRequiredAttributes() { 1505 bool ret = libsbmlPINVOKE.Unit_hasRequiredAttributes(swigCPtr); 1506 return ret; 1507 } 1508 1509 1510 /** */ /* libsbml-internal */ public setExponentUnitChecking(double value)1511 void setExponentUnitChecking(double value) { 1512 libsbmlPINVOKE.Unit_setExponentUnitChecking(swigCPtr, value); 1513 } 1514 1515 1516 /** */ /* libsbml-internal */ public getExponentUnitChecking()1517 double getExponentUnitChecking() { 1518 double ret = libsbmlPINVOKE.Unit_getExponentUnitChecking__SWIG_0(swigCPtr); 1519 return ret; 1520 } 1521 1522 1523 /** */ /* libsbml-internal */ public isUnitChecking()1524 bool isUnitChecking() { 1525 bool ret = libsbmlPINVOKE.Unit_isUnitChecking__SWIG_0(swigCPtr); 1526 return ret; 1527 } 1528 1529 } 1530 1531 } 1532