001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.11 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * 013 * Implementation of SBML's Unit construct. 014 * <p> 015 * The SBML unit definition facility uses two classes of objects, 016 * {@link UnitDefinition} and {@link Unit}. The approach to defining units in SBML is 017 * compositional; for example, <em>meter second<sup> –2</sup></em> is 018 * constructed by combining a {@link Unit} object representing <em>meter</em> with 019 * another {@link Unit} object representing <em>second<sup> –2</sup></em>. 020 * The combination is wrapped inside a {@link UnitDefinition}, which provides for 021 * assigning an identifier and optional name to the combination. The 022 * identifier can then be referenced from elsewhere in a model. Thus, the 023 * {@link UnitDefinition} class is the container, and {@link Unit} instances are placed 024 * inside {@link UnitDefinition} instances. 025 * <p> 026 * A {@link Unit} structure has four attributes named 'kind', 'exponent', 'scale' 027 * and 'multiplier'. It represents a (possibly transformed) reference to a 028 * base unit. The attribute 'kind' on {@link Unit} indicates the chosen base unit. 029 * Its value must be one of the text strings listed below; this list 030 * corresponds to SBML Level 3 Version 1 Core: 031 * <p> 032 * <center> 033<table border='0' class='text-table width80 normal-font' 034 style='border-top: none !important; border-bottom: none !important; color: black; font-weight: bold; font-family: Courier New, Courier, monospace, fixed;'> 035<tr> 036<td>ampere</td><td>farad</td><td>joule</td><td>lux</td><td>radian</td><td>volt</td> 037</tr> 038<tr> 039<td>avogadro</td><td>gram</td><td>katal</td><td>metre</td><td>second</td><td>watt</td> 040</tr> 041<tr> 042<td>becquerel</td><td>gray</td><td>kelvin</td><td>mole</td><td>siemens</td><td>weber</td> 043</tr> 044<tr> 045<td>candela</td><td>henry</td><td>kilogram</td><td>newton</td><td>sievert</td> 046</tr> 047<tr> 048<td>coulomb</td><td>hertz</td><td>litre</td><td>ohm</td><td>steradian</td> 049</tr> 050<tr> 051<td>dimensionless</td><td>item</td><td>lumen</td><td>pascal</td><td>tesla</td> 052</tr> 053</table> 054</center> 055 056 * <p> 057 * A few small differences exist between the Level 3 list of base 058 * units and the list defined in other Level/Version combinations of SBML. 059 * Specifically, Levels of SBML before Level 3 do not define 060 * <code>avogadro</code>; conversely, Level 2 Version 1 defines <code>Celsius</code>, 061 * and Level 1 defines <code>celsius</code>, <code>meter</code>, and <code>liter</code>, none of 062 * which are available in Level 3. In libSBML, each of the predefined 063 * base unit names is represented by an enumeration value whose name begins with the characters 064 * <code>UNIT_KIND_</code>, discussed in a separate section below. 065 * <p> 066 * The attribute named 'exponent' on {@link Unit} represents an exponent on the 067 * unit. In SBML Level 2, the attribute is optional and has a default 068 * value of <code>1</code> (one); in SBML Level 3, the attribute is mandatory 069 * and there is no default value. A {@link Unit} structure also has an attribute 070 * called 'scale'; its value must be an integer exponent for a power-of-ten 071 * multiplier used to set the scale of the unit. For example, a unit 072 * having a 'kind' value of <code>gram</code> and a 'scale' value of <code>-3</code> signifies 073 * 10<sup> –3</sup> × gram, or milligrams. In SBML 074 * Level 2, the attribute is optional and has a default value of <code>0</code> 075 * (zero), because 10<sup> 0</sup> = 1; in SBML Level 3, the attribute 076 * is mandatory and has no default value. Lastly, the attribute named 077 * 'multiplier' can be used to multiply the unit by a real-numbered factor; 078 * this enables the definition of units that are not power-of-ten multiples 079 * of SI units. For instance, a multiplier of 0.3048 could be used to 080 * define <code>foot</code> as a measure of length in terms of a <code>metre.</code> The 081 * 'multiplier' attribute is optional in SBML Level 2, where it has a 082 * default value of <code>1</code> (one); in SBML Level 3, the attribute is 083 * mandatory and has not default value. 084 * <p> 085 * * <h3><a class='anchor' name='UnitKind_t'>%Unit identification codes</a></h3> 086 * <p> 087 * <p> 088 * As discussed above, SBML defines a set of base units which serves as the 089 * starting point for new unit definitions. This set of base units 090 * consists of the SI units and a small number of additional convenience 091 * units. 092 * <p> 093 * In SBML Level 2 Versions before 094 * Version 3, there existed an enumeration of units called 095 * <code>UnitKind.</code> In Version 3, this enumeration was removed and the 096 * identifier class <code>UnitSId</code> redefined to include the previous 097 * <code>UnitKind</code> values as reserved symbols. This change has no net effect on 098 * permissible models, their representation or their syntax. The purpose 099 * of the change in the SBML specification was simply to clean up an 100 * inconsistency about the contexts in which these values were usable. 101 * However, libSBML maintains UnitKind in the form of of a set of static 102 * integer constants whose names begin with the characters 103 * <code>UNIT_KIND_</code>. These constants are defined in the class 104 * <code><a href='libsbmlConstants.html'>libsbmlConstants</a></code>. 105 * <p> 106 * <p> 107 * As a consequence of the fact that libSBML supports models in all Levels 108 * and Versions of SBML, libSBML's set of <code>UNIT_KIND_</code> values is a union 109 * of all the possible base unit names defined in the different SBML 110 * specifications. However, not every base unit is allowed in every 111 * Level+Version combination of SBML. Note in particular the following 112 * exceptions: 113 * <ul> 114 * <li> The alternate spelling <code>'meter'</code> is included in 115 * addition to the official SI spelling <code>'metre'.</code> This spelling is only 116 * permitted in SBML Level 1 models. 117 * <p> 118 * <li> The alternate spelling <code>'liter'</code> is included in addition to the 119 * official SI spelling <code>'litre'.</code> This spelling is only permitted in 120 * SBML Level 1 models. 121 * <p> 122 * <li> The unit <code>'Celsius'</code> is included because of its presence in 123 * specifications of SBML prior to SBML Level 2 Version 3. 124 * <p> 125 * <li> The unit <code>avogadro</code> was introduced in SBML Level 3, and 126 * is only permitted for use in SBML Level 3 models. 127 * </ul> 128 * <p> 129 * The table below lists the unit 130 * constants defined in libSBML, and their meanings. 131 * <p> 132 * <center> 133<table border='0' class='text-table width80 normal-font alt-row-colors'> 134 <tr> 135 <th align='left' width='200'>Enumerator</th> 136 <th align='left'>Meaning</th> 137 </tr> 138<tr><td><code>UNIT_KIND_AMPERE</code></td><td>The ampere unit.</td></tr> 139<tr><td><code>UNIT_KIND_AVOGADRO</code></td><td>The unit 140<code>dimensionless</code> multiplied by the numerical value of Avogadro's 141constant. (<span class='warning'>Only usable in SBML Level 3 models.</span>)</td></tr> 142<tr><td><code>UNIT_KIND_BECQUEREL</code></td><td>The becquerel unit.</td></tr> 143<tr><td><code>UNIT_KIND_CANDELA</code></td><td>The candela unit.</td></tr> 144<tr><td><code>UNIT_KIND_CELSIUS</code></td><td>The Celsius unit. (<span 145class='warning'>Only usable in SBML Level 1 and SBML Level 2 146Version 1 models.</span>)</td></tr> 147<tr><td><code>UNIT_KIND_COULOMB</code></td><td>The coulomb unit.</td></tr> 148<tr><td><code>UNIT_KIND_DIMENSIONLESS</code></td><td>A pseudo-unit 149indicating a dimensionless quantity.</td></tr> 150<tr><td><code>UNIT_KIND_FARAD</code></td><td>The farad unit.</td></tr> 151<tr><td><code>UNIT_KIND_GRAM</code></td><td>The gram unit.</td></tr> 152<tr><td><code>UNIT_KIND_GRAY</code></td><td>The gray unit.</td></tr> 153<tr><td><code>UNIT_KIND_HENRY</code></td><td>The henry unit.</td></tr> 154<tr><td><code>UNIT_KIND_HERTZ</code></td><td>The hertz unit.</td></tr> 155<tr><td><code>UNIT_KIND_ITEM</code></td><td>A pseudo-unit representing a 156single 'thing'.</td></tr> 157<tr><td><code>UNIT_KIND_JOULE</code></td><td>The joule unit.</td></tr> 158<tr><td><code>UNIT_KIND_KATAL</code></td><td>The katal unit.</td></tr> 159<tr><td><code>UNIT_KIND_KELVIN</code></td><td>The kelvin unit.</td></tr> 160<tr><td><code>UNIT_KIND_KILOGRAM</code></td><td>The kilogram unit.</td></tr> 161<tr><td><code>UNIT_KIND_LITER</code></td><td>Alternate spelling of litre.</td></tr> 162<tr><td><code>UNIT_KIND_LITRE</code></td><td>The litre unit.</td></tr> 163<tr><td><code>UNIT_KIND_LUMEN</code></td><td>The lumen unit.</td></tr> 164<tr><td><code>UNIT_KIND_LUX</code></td><td>The lux unit.</td></tr> 165<tr><td><code>UNIT_KIND_METER</code></td><td>Alternate spelling of metre.</td></tr> 166<tr><td><code>UNIT_KIND_METRE</code></td><td>The metre unit.</td></tr> 167<tr><td><code>UNIT_KIND_MOLE</code></td><td>The mole unit.</td></tr> 168<tr><td><code>UNIT_KIND_NEWTON</code></td><td>The newton unit.</td></tr> 169<tr><td><code>UNIT_KIND_OHM</code></td><td>The ohm unit.</td></tr> 170<tr><td><code>UNIT_KIND_PASCAL</code></td><td>The pascal unit.</td></tr> 171<tr><td><code>UNIT_KIND_RADIAN</code></td><td>The radian unit.</td></tr> 172<tr><td><code>UNIT_KIND_SECOND</code></td><td>The second unit.</td></tr> 173<tr><td><code>UNIT_KIND_SIEMENS</code></td><td>The siemens unit.</td></tr> 174<tr><td><code>UNIT_KIND_SIEVERT</code></td><td>The sievert unit.</td></tr> 175<tr><td><code>UNIT_KIND_STERADIAN</code></td><td>The steradian unit.</td></tr> 176<tr><td><code>UNIT_KIND_TESLA</code></td><td>The tesla unit.</td></tr> 177<tr><td><code>UNIT_KIND_VOLT</code></td><td>The volt unit.</td></tr> 178<tr><td><code>UNIT_KIND_WATT</code></td><td>The watt unit.</td></tr> 179<tr><td><code>UNIT_KIND_WEBER</code></td><td>The weber unit.</td></tr> 180<tr><td><code>UNIT_KIND_INVALID</code></td><td>Marker used by libSBML 181to indicate an invalid or unset unit.</td></tr> 182</table> 183</center> 184 185 * <p> 186 * <!-- leave this next break as-is to work around some doxygen bug --> 187 */ 188 189public class Unit extends SBase { 190 private long swigCPtr; 191 192 protected Unit(long cPtr, boolean cMemoryOwn) 193 { 194 super(libsbmlJNI.Unit_SWIGUpcast(cPtr), cMemoryOwn); 195 swigCPtr = cPtr; 196 } 197 198 protected static long getCPtr(Unit obj) 199 { 200 return (obj == null) ? 0 : obj.swigCPtr; 201 } 202 203 protected static long getCPtrAndDisown (Unit obj) 204 { 205 long ptr = 0; 206 207 if (obj != null) 208 { 209 ptr = obj.swigCPtr; 210 obj.swigCMemOwn = false; 211 } 212 213 return ptr; 214 } 215 216 protected void finalize() { 217 delete(); 218 } 219 220 public synchronized void delete() { 221 if (swigCPtr != 0) { 222 if (swigCMemOwn) { 223 swigCMemOwn = false; 224 libsbmlJNI.delete_Unit(swigCPtr); 225 } 226 swigCPtr = 0; 227 } 228 super.delete(); 229 } 230 231 232/** 233 * Creates a new {@link Unit} using the given SBML <code>level</code> and <code>version</code> 234 * values. 235 * <p> 236 * @param level a long integer, the SBML Level to assign to this {@link Unit} 237 * <p> 238 * @param version a long integer, the SBML Version to assign to this 239 * {@link Unit} 240 * <p> 241 * @throws SBMLConstructorException 242 * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind 243 * of SBML object, are either invalid or mismatched with respect to the 244 * parent {@link SBMLDocument} object. 245 * <p> 246 * @note Upon the addition of a {@link Unit} object to an {@link SBMLDocument}, the SBML 247 * Level, SBML Version and XML namespace of the document 248 * <em>override</em> the values used when creating the {@link Unit} object via this 249 * constructor. This is necessary to ensure that an SBML document is a 250 * consistent structure. Nevertheless, the ability to supply the values 251 * at the time of creation of a {@link Unit} is an important aid to producing 252 * valid SBML. Knowledge of the intented SBML Level and Version 253 * determine whether it is valid to assign a particular value to an 254 * attribute, or whether it is valid to add an object to an existing 255 * {@link SBMLDocument}. 256 */ public 257 Unit(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 258 this(libsbmlJNI.new_Unit__SWIG_0(level, version), true); 259 } 260 261 262/** 263 * Creates a new {@link Unit} using the given {@link SBMLNamespaces} object 264 * <code>sbmlns</code>. 265 * <p> 266 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 267 * information. It is used to communicate the SBML Level, Version, and 268 * (in Level 3) packages used in addition to SBML Level 3 Core. 269 * A common approach to using this class constructor is to create an 270 * {@link SBMLNamespaces} object somewhere in a program, once, then pass it to 271 * object constructors such as this one when needed. 272 * <p> 273 * @param sbmlns an {@link SBMLNamespaces} object. 274 * <p> 275 * @throws SBMLConstructorException 276 * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind 277 * of SBML object, are either invalid or mismatched with respect to the 278 * parent {@link SBMLDocument} object. 279 * <p> 280 * @note Upon the addition of a {@link Unit} object to an {@link SBMLDocument}, the SBML 281 * XML namespace of the document <em>overrides</em> the value used when 282 * creating the {@link Unit} object via this constructor. This is necessary to 283 * ensure that an SBML document is a consistent structure. Nevertheless, 284 * the ability to supply the values at the time of creation of a {@link Unit} is 285 * an important aid to producing valid SBML. Knowledge of the intented 286 * SBML Level and Version determine whether it is valid to assign a 287 * particular value to an attribute, or whether it is valid to add an 288 * object to an existing {@link SBMLDocument}. 289 */ public 290 Unit(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 291 this(libsbmlJNI.new_Unit__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 292 } 293 294 295/** 296 * Copy constructor; creates a copy of this {@link Unit}. 297 * <p> 298 * @param orig the object to copy. 299 * <p> 300 * @throws SBMLConstructorException 301 * Thrown if the argument <code>orig</code> is <code>null.</code> 302 */ public 303 Unit(Unit orig) throws org.sbml.libsbml.SBMLConstructorException { 304 this(libsbmlJNI.new_Unit__SWIG_2(Unit.getCPtr(orig), orig), true); 305 } 306 307 308/** 309 * Creates and returns a deep copy of this {@link Unit}. 310 * <p> 311 * @return a (deep) copy of this {@link Unit}. 312 */ public 313 Unit cloneObject() { 314 long cPtr = libsbmlJNI.Unit_cloneObject(swigCPtr, this); 315 return (cPtr == 0) ? null : new Unit(cPtr, true); 316 } 317 318 319/** 320 * Initializes the fields of this {@link Unit} object to 'typical' default 321 * values. 322 * <p> 323 * The SBML {@link Unit} component has slightly different aspects and default 324 * attribute values in different SBML Levels and Versions. This method 325 * sets the values to certain common defaults, based mostly on what they 326 * are in SBML Level 2. Specifically: 327 * <ul> 328 * <li> Sets attribute 'exponent' to <code>1</code> 329 * <li> Sets attribute 'scale' to <code>0</code> 330 * <li> Sets attribute 'multiplier' to <code>1.0</code> 331 * </ul> 332 * <p> 333 * The 'kind' attribute is left unchanged. 334 */ public 335 void initDefaults() { 336 libsbmlJNI.Unit_initDefaults(swigCPtr, this); 337 } 338 339 340/** 341 * Returns the 'kind' of {@link Unit} this is. 342 * <p> 343 * @return the value of the 'kind' attribute of this {@link Unit} as a 344 * value from the set of constants whose names begin 345 * with <code>UNIT_KIND_</code> defined in the class 346 * <code><a href='libsbmlConstants.html'>libsbmlConstants</a></code>. 347 * <p> 348 */ public 349 int getKind() { 350 return libsbmlJNI.Unit_getKind(swigCPtr, this); 351 } 352 353 354/** 355 * Returns the value of the 'exponent' attribute of this unit. 356 * <p> 357 * @return the 'exponent' value of this {@link Unit}, as an integer. 358 */ public 359 int getExponent() { 360 return libsbmlJNI.Unit_getExponent(swigCPtr, this); 361 } 362 363 364/** 365 * Returns the value of the 'exponent' attribute of this unit. 366 * <p> 367 * @return the 'exponent' value of this {@link Unit}, as a double. 368 */ public 369 double getExponentAsDouble() { 370 return libsbmlJNI.Unit_getExponentAsDouble(swigCPtr, this); 371 } 372 373 374/** 375 * Returns the value of the 'scale' attribute of this unit. 376 * <p> 377 * @return the 'scale' value of this {@link Unit}, as an integer. 378 */ public 379 int getScale() { 380 return libsbmlJNI.Unit_getScale(swigCPtr, this); 381 } 382 383 384/** 385 * Returns the value of the 'multiplier' attribute of this {@link Unit}. 386 * <p> 387 * @return the 'multiplier' value of this {@link Unit}, as a double. 388 */ public 389 double getMultiplier() { 390 return libsbmlJNI.Unit_getMultiplier(swigCPtr, this); 391 } 392 393 394/** 395 * Returns the value of the 'offset' attribute of this {@link Unit}. 396 * <p> 397 * @warning The 'offset' attribute is only available in SBML Level 2 398 * Version 1. This attribute is not present in SBML Level 2 399 * Version 2 or above. When producing SBML models using these later 400 * specifications, modelers and software tools need to account for units 401 * with offsets explicitly. The SBML specification document offers a 402 * number of suggestions for how to achieve this. LibSBML methods such 403 * as this one related to 'offset' are retained for compatibility with 404 * earlier versions of SBML Level 2, but their use is strongly 405 * discouraged. 406 * <p> 407 * @return the 'offset' value of this {@link Unit}, as a double. 408 */ public 409 double getOffset() { 410 return libsbmlJNI.Unit_getOffset(swigCPtr, this); 411 } 412 413 414/** 415 * Predicate for testing whether this {@link Unit} is of the kind <code>ampere.</code> 416 * <p> 417 * @return <code>true</code> if the kind of this {@link Unit} is <code>ampere</code>, <code>false</code> 418 * otherwise. 419 */ public 420 boolean isAmpere() { 421 return libsbmlJNI.Unit_isAmpere(swigCPtr, this); 422 } 423 424 425/** 426 * Predicate for testing whether this {@link Unit} is of the kind <code>avogadro.</code> 427 * <p> 428 * @return <code>true</code> if the kind of this {@link Unit} is <code>avogadro</code>, <code>false</code> 429 * otherwise. 430 * <p> 431 * @note The unit <code>avogadro</code> was introduced in SBML Level 3, and 432 * is only permitted for use in SBML Level 3 models. 433 */ public 434 boolean isAvogadro() { 435 return libsbmlJNI.Unit_isAvogadro(swigCPtr, this); 436 } 437 438 439/** 440 * Predicate for testing whether this {@link Unit} is of the kind <code>becquerel</code> 441 * <p> 442 * @return <code>true</code> if the kind of this {@link Unit} is <code>becquerel</code>, <code>false</code> 443 * otherwise. 444 */ public 445 boolean isBecquerel() { 446 return libsbmlJNI.Unit_isBecquerel(swigCPtr, this); 447 } 448 449 450/** 451 * Predicate for testing whether this {@link Unit} is of the kind <code>candela</code> 452 * <p> 453 * @return <code>true</code> if the kind of this {@link Unit} is <code>candela</code>, <code>false</code> 454 * otherwise. 455 */ public 456 boolean isCandela() { 457 return libsbmlJNI.Unit_isCandela(swigCPtr, this); 458 } 459 460 461/** 462 * Predicate for testing whether this {@link Unit} is of the kind <code>Celsius</code> 463 * <p> 464 * @return <code>true</code> if the kind of this {@link Unit} is <code>Celsius</code>, <code>false</code> 465 * otherwise. 466 * <p> 467 * @warning The predefined unit <code>Celsius</code> was removed from the list of 468 * predefined units in SBML Level 2 Version 2 at the same time 469 * that the 'offset' attribute was removed from {@link Unit} definitions. 470 * LibSBML methods such as this one related to <code>Celsius</code> are retained in 471 * order to support SBML Level 2 Version 1, but their use is 472 * strongly discouraged. 473 */ public 474 boolean isCelsius() { 475 return libsbmlJNI.Unit_isCelsius(swigCPtr, this); 476 } 477 478 479/** 480 * Predicate for testing whether this {@link Unit} is of the kind <code>coulomb</code> 481 * <p> 482 * @return <code>true</code> if the kind of this {@link Unit} is <code>coulomb</code>, <code>false</code> 483 * otherwise. 484 */ public 485 boolean isCoulomb() { 486 return libsbmlJNI.Unit_isCoulomb(swigCPtr, this); 487 } 488 489 490/** 491 * Predicate for testing whether this {@link Unit} is of the kind 492 * <code>dimensionless.</code> 493 * <p> 494 * @return <code>true</code> if the kind of this {@link Unit} is <code>dimensionless</code>, <code>false</code> 495 * <p> 496 * otherwise. 497 */ public 498 boolean isDimensionless() { 499 return libsbmlJNI.Unit_isDimensionless(swigCPtr, this); 500 } 501 502 503/** 504 * Predicate for testing whether this {@link Unit} is of the kind <code>farad</code> 505 * <p> 506 * @return <code>true</code> if the kind of this {@link Unit} is <code>farad</code>, <code>false</code> 507 * otherwise. 508 */ public 509 boolean isFarad() { 510 return libsbmlJNI.Unit_isFarad(swigCPtr, this); 511 } 512 513 514/** 515 * Predicate for testing whether this {@link Unit} is of the kind <code>gram</code> 516 * <p> 517 * @return <code>true</code> if the kind of this {@link Unit} is <code>gram</code>, <code>false</code> 518 * otherwise. 519 */ public 520 boolean isGram() { 521 return libsbmlJNI.Unit_isGram(swigCPtr, this); 522 } 523 524 525/** 526 * Predicate for testing whether this {@link Unit} is of the kind <code>gray</code> 527 * <p> 528 * @return <code>true</code> if the kind of this {@link Unit} is <code>gray</code>, <code>false</code> 529 * otherwise. 530 */ public 531 boolean isGray() { 532 return libsbmlJNI.Unit_isGray(swigCPtr, this); 533 } 534 535 536/** 537 * Predicate for testing whether this {@link Unit} is of the kind <code>henry</code> 538 * <p> 539 * @return <code>true</code> if the kind of this {@link Unit} is <code>henry</code>, <code>false</code> 540 * otherwise. 541 */ public 542 boolean isHenry() { 543 return libsbmlJNI.Unit_isHenry(swigCPtr, this); 544 } 545 546 547/** 548 * Predicate for testing whether this {@link Unit} is of the kind <code>hertz</code> 549 * <p> 550 * @return <code>true</code> if the kind of this {@link Unit} is <code>hertz</code>, <code>false</code> 551 * otherwise. 552 */ public 553 boolean isHertz() { 554 return libsbmlJNI.Unit_isHertz(swigCPtr, this); 555 } 556 557 558/** 559 * Predicate for testing whether this {@link Unit} is of the kind <code>item</code> 560 * <p> 561 * @return <code>true</code> if the kind of this {@link Unit} is <code>item</code>, <code>false</code> 562 * otherwise. 563 */ public 564 boolean isItem() { 565 return libsbmlJNI.Unit_isItem(swigCPtr, this); 566 } 567 568 569/** 570 * Predicate for testing whether this {@link Unit} is of the kind <code>joule</code> 571 * <p> 572 * @return <code>true</code> if the kind of this {@link Unit} is <code>joule</code>, <code>false</code> 573 * otherwise. 574 */ public 575 boolean isJoule() { 576 return libsbmlJNI.Unit_isJoule(swigCPtr, this); 577 } 578 579 580/** 581 * Predicate for testing whether this {@link Unit} is of the kind <code>katal</code> 582 * <p> 583 * @return <code>true</code> if the kind of this {@link Unit} is <code>katal</code>, <code>false</code> 584 * otherwise. 585 */ public 586 boolean isKatal() { 587 return libsbmlJNI.Unit_isKatal(swigCPtr, this); 588 } 589 590 591/** 592 * Predicate for testing whether this {@link Unit} is of the kind <code>kelvin</code> 593 * <p> 594 * @return <code>true</code> if the kind of this {@link Unit} is <code>kelvin</code>, <code>false</code> 595 * otherwise. 596 */ public 597 boolean isKelvin() { 598 return libsbmlJNI.Unit_isKelvin(swigCPtr, this); 599 } 600 601 602/** 603 * Predicate for testing whether this {@link Unit} is of the kind <code>kilogram</code> 604 * <p> 605 * @return <code>true</code> if the kind of this {@link Unit} is <code>kilogram</code>, <code>false</code> 606 * otherwise. 607 */ public 608 boolean isKilogram() { 609 return libsbmlJNI.Unit_isKilogram(swigCPtr, this); 610 } 611 612 613/** 614 * Predicate for testing whether this {@link Unit} is of the kind <code>litre</code> 615 * <p> 616 * @return <code>true</code> if the kind of this {@link Unit} is <code>litre</code> or 'liter', 617 * <code>false</code> 618 * otherwise. 619 */ public 620 boolean isLitre() { 621 return libsbmlJNI.Unit_isLitre(swigCPtr, this); 622 } 623 624 625/** 626 * Predicate for testing whether this {@link Unit} is of the kind <code>lumen</code> 627 * <p> 628 * @return <code>true</code> if the kind of this {@link Unit} is <code>lumen</code>, <code>false</code> 629 * otherwise. 630 */ public 631 boolean isLumen() { 632 return libsbmlJNI.Unit_isLumen(swigCPtr, this); 633 } 634 635 636/** 637 * Predicate for testing whether this {@link Unit} is of the kind <code>lux</code> 638 * <p> 639 * @return <code>true</code> if the kind of this {@link Unit} is <code>lux</code>, <code>false</code> 640 * otherwise. 641 */ public 642 boolean isLux() { 643 return libsbmlJNI.Unit_isLux(swigCPtr, this); 644 } 645 646 647/** 648 * Predicate for testing whether this {@link Unit} is of the kind <code>metre</code> 649 * <p> 650 * @return <code>true</code> if the kind of this {@link Unit} is <code>metre</code> or 'meter', 651 * <code>false</code> 652 * otherwise. 653 */ public 654 boolean isMetre() { 655 return libsbmlJNI.Unit_isMetre(swigCPtr, this); 656 } 657 658 659/** 660 * Predicate for testing whether this {@link Unit} is of the kind <code>mole</code> 661 * <p> 662 * @return <code>true</code> if the kind of this {@link Unit} is <code>mole</code>, <code>false</code> 663 * otherwise. 664 */ public 665 boolean isMole() { 666 return libsbmlJNI.Unit_isMole(swigCPtr, this); 667 } 668 669 670/** 671 * Predicate for testing whether this {@link Unit} is of the kind <code>newton</code> 672 * <p> 673 * @return <code>true</code> if the kind of this {@link Unit} is <code>newton</code>, <code>false</code> 674 * otherwise. 675 */ public 676 boolean isNewton() { 677 return libsbmlJNI.Unit_isNewton(swigCPtr, this); 678 } 679 680 681/** 682 * Predicate for testing whether this {@link Unit} is of the kind <code>ohm</code> 683 * <p> 684 * @return <code>true</code> if the kind of this {@link Unit} is <code>ohm</code>, <code>false</code> 685 * otherwise. 686 */ public 687 boolean isOhm() { 688 return libsbmlJNI.Unit_isOhm(swigCPtr, this); 689 } 690 691 692/** 693 * Predicate for testing whether this {@link Unit} is of the kind <code>pascal</code> 694 * <p> 695 * @return <code>true</code> if the kind of this {@link Unit} is <code>pascal</code>, <code>false</code> 696 * otherwise. 697 */ public 698 boolean isPascal() { 699 return libsbmlJNI.Unit_isPascal(swigCPtr, this); 700 } 701 702 703/** 704 * Predicate for testing whether this {@link Unit} is of the kind <code>radian</code> 705 * <p> 706 * @return <code>true</code> if the kind of this {@link Unit} is <code>radian</code>, <code>false</code> 707 * otherwise. 708 */ public 709 boolean isRadian() { 710 return libsbmlJNI.Unit_isRadian(swigCPtr, this); 711 } 712 713 714/** 715 * Predicate for testing whether this {@link Unit} is of the kind <code>second</code> 716 * <p> 717 * @return <code>true</code> if the kind of this {@link Unit} is <code>second</code>, <code>false</code> 718 * otherwise. 719 */ public 720 boolean isSecond() { 721 return libsbmlJNI.Unit_isSecond(swigCPtr, this); 722 } 723 724 725/** 726 * Predicate for testing whether this {@link Unit} is of the kind <code>siemens</code> 727 * <p> 728 * @return <code>true</code> if the kind of this {@link Unit} is <code>siemens</code>, <code>false</code> 729 * otherwise. 730 */ public 731 boolean isSiemens() { 732 return libsbmlJNI.Unit_isSiemens(swigCPtr, this); 733 } 734 735 736/** 737 * Predicate for testing whether this {@link Unit} is of the kind <code>sievert</code> 738 * <p> 739 * @return <code>true</code> if the kind of this {@link Unit} is <code>sievert</code>, <code>false</code> 740 * otherwise. 741 */ public 742 boolean isSievert() { 743 return libsbmlJNI.Unit_isSievert(swigCPtr, this); 744 } 745 746 747/** 748 * Predicate for testing whether this {@link Unit} is of the kind <code>steradian</code> 749 * <p> 750 * @return <code>true</code> if the kind of this {@link Unit} is <code>steradian</code>, <code>false</code> 751 * otherwise. 752 */ public 753 boolean isSteradian() { 754 return libsbmlJNI.Unit_isSteradian(swigCPtr, this); 755 } 756 757 758/** 759 * Predicate for testing whether this {@link Unit} is of the kind <code>tesla</code> 760 * <p> 761 * @return <code>true</code> if the kind of this {@link Unit} is <code>tesla</code>, <code>false</code> 762 * otherwise. 763 */ public 764 boolean isTesla() { 765 return libsbmlJNI.Unit_isTesla(swigCPtr, this); 766 } 767 768 769/** 770 * Predicate for testing whether this {@link Unit} is of the kind <code>volt</code> 771 * <p> 772 * @return <code>true</code> if the kind of this {@link Unit} is <code>volt</code>, <code>false</code> 773 * otherwise. 774 */ public 775 boolean isVolt() { 776 return libsbmlJNI.Unit_isVolt(swigCPtr, this); 777 } 778 779 780/** 781 * Predicate for testing whether this {@link Unit} is of the kind <code>watt</code> 782 * <p> 783 * @return <code>true</code> if the kind of this {@link Unit} is <code>watt</code>, <code>false</code> 784 * otherwise. 785 */ public 786 boolean isWatt() { 787 return libsbmlJNI.Unit_isWatt(swigCPtr, this); 788 } 789 790 791/** 792 * Predicate for testing whether this {@link Unit} is of the kind <code>weber</code> 793 * <p> 794 * @return <code>true</code> if the kind of this {@link Unit} is <code>weber</code>, <code>false</code> 795 * otherwise. 796 */ public 797 boolean isWeber() { 798 return libsbmlJNI.Unit_isWeber(swigCPtr, this); 799 } 800 801 802/** 803 * Predicate to test whether the 'kind' attribute of this {@link Unit} is set. 804 * <p> 805 * @return <code>true</code> if the 'kind' attribute of this {@link Unit} is set, 806 * <code>false</code> otherwise. 807 */ public 808 boolean isSetKind() { 809 return libsbmlJNI.Unit_isSetKind(swigCPtr, this); 810 } 811 812 813/** 814 * Predicate to test whether the 'exponent' attribute of this {@link Unit} 815 * is set. 816 * <p> 817 * @return <code>true</code> if the 'exponent' attribute of this {@link Unit} is set, 818 * <code>false</code> otherwise. 819 */ public 820 boolean isSetExponent() { 821 return libsbmlJNI.Unit_isSetExponent(swigCPtr, this); 822 } 823 824 825/** 826 * Predicate to test whether the 'scale' attribute of this {@link Unit} 827 * is set. 828 * <p> 829 * @return <code>true</code> if the 'scale' attribute of this {@link Unit} is set, 830 * <code>false</code> otherwise. 831 */ public 832 boolean isSetScale() { 833 return libsbmlJNI.Unit_isSetScale(swigCPtr, this); 834 } 835 836 837/** 838 * Predicate to test whether the 'multiplier' attribute of this {@link Unit} 839 * is set. 840 * <p> 841 * @return <code>true</code> if the 'multiplier' attribute of this {@link Unit} is set, 842 * <code>false</code> otherwise. 843 */ public 844 boolean isSetMultiplier() { 845 return libsbmlJNI.Unit_isSetMultiplier(swigCPtr, this); 846 } 847 848 849/** 850 * Sets the 'kind' attribute value of this {@link Unit}. 851 * <p> 852 * @param kind a unit identifier chosen from the set of constants whose 853 * names begin with <code>UNIT_KIND_</code> in <code><a 854 * href='libsbmlConstants.html'>libsbmlConstants</a></code>. 855 * <p> 856 * <p> 857 * @return integer value indicating success/failure of the 858 * function. The possible values 859 * returned by this function are: 860 * <ul> 861 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 862 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 863 * </ul> 864 */ public 865 int setKind(int kind) { 866 return libsbmlJNI.Unit_setKind(swigCPtr, this, kind); 867 } 868 869 870/** 871 * Sets the 'exponent' attribute value of this {@link Unit}. 872 * <p> 873 * @param value the integer to which the attribute 'exponent' should be set 874 * <p> 875 * @return integer value indicating success/failure of the 876 * function. The possible values 877 * returned by this function are: 878 * <ul> 879 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 880 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 881 * </ul> 882 */ public 883 int setExponent(int value) { 884 return libsbmlJNI.Unit_setExponent__SWIG_0(swigCPtr, this, value); 885 } 886 887 888/** 889 * Sets the 'exponent' attribute value of this {@link Unit}. 890 * <p> 891 * @param value the double to which the attribute 'exponent' should be set 892 * <p> 893 * @return integer value indicating success/failure of the 894 * function. The possible values 895 * returned by this function are: 896 * <ul> 897 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 898 * </ul> 899 */ public 900 int setExponent(double value) { 901 return libsbmlJNI.Unit_setExponent__SWIG_1(swigCPtr, this, value); 902 } 903 904 905/** 906 * Sets the 'scale' attribute value of this {@link Unit}. 907 * <p> 908 * @param value the integer to which the attribute 'scale' should be set 909 * <p> 910 * @return integer value indicating success/failure of the 911 * function. The possible values 912 * returned by this function are: 913 * <ul> 914 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 915 * </ul> 916 */ public 917 int setScale(int value) { 918 return libsbmlJNI.Unit_setScale(swigCPtr, this, value); 919 } 920 921 922/** 923 * Sets the 'multipler' attribute value of this {@link Unit}. 924 * <p> 925 * @param value the floating-point value to which the attribute 926 * 'multiplier' should be set 927 * <p> 928 * @return integer value indicating success/failure of the 929 * function. The possible values 930 * returned by this function are: 931 * <ul> 932 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 933 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 934 * </ul> 935 */ public 936 int setMultiplier(double value) { 937 return libsbmlJNI.Unit_setMultiplier(swigCPtr, this, value); 938 } 939 940 941/** 942 * Sets the 'offset' attribute value of this {@link Unit}. 943 * <p> 944 * @param value the float-point value to which the attribute 'offset' 945 * should set 946 * <p> 947 * @return integer value indicating success/failure of the 948 * function. The possible values 949 * returned by this function are: 950 * <ul> 951 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 952 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 953 * </ul> 954 * <p> 955 * @warning The 'offset' attribute is only available in SBML Level 2 956 * Version 1. This attribute is not present in SBML Level 2 957 * Version 2 or above. When producing SBML models using these later 958 * specifications, modelers and software tools need to account for units 959 * with offsets explicitly. The SBML specification document offers a 960 * number of suggestions for how to achieve this. LibSBML methods such 961 * as this one related to 'offset' are retained for compatibility with 962 * earlier versions of SBML Level 2, but their use is strongly 963 * discouraged. 964 */ public 965 int setOffset(double value) { 966 return libsbmlJNI.Unit_setOffset(swigCPtr, this, value); 967 } 968 969 970/** 971 * Returns the libSBML type code of this object instance. 972 * <p> 973 * LibSBML attaches an identifying code to every 974 * kind of SBML object. These are known as <em>SBML type codes</em>. In 975 * other languages, the set of type codes is stored in an enumeration; in 976 * the Java language interface for libSBML, the type codes are defined as 977 * static integer constants in the interface class {@link 978 * libsbmlConstants}. The names of the type codes all begin with the 979 * characters <code>SBML_.</code> 980 * <p> 981 * @return the SBML type code for this object, or {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} (default). 982 * <p> 983 * @see #getElementName() 984 */ public 985 int getTypeCode() { 986 return libsbmlJNI.Unit_getTypeCode(swigCPtr, this); 987 } 988 989 990/** 991 * Returns the XML element name of this object, which for {@link Unit}, is 992 * always <code>'unit'.</code> 993 * <p> 994 * @return the name of this element, i.e., <code>'unit'.</code> 995 */ public 996 String getElementName() { 997 return libsbmlJNI.Unit_getElementName(swigCPtr, this); 998 } 999 1000 1001/** 1002 * Predicate to test whether a given string is the name of a 1003 * predefined SBML unit. 1004 * <p> 1005 * @param name a string to be tested against the predefined unit names 1006 * <p> 1007 * @param level the Level of SBML for which the determination should be 1008 * made. This is necessary because there are a few small differences 1009 * in allowed units between SBML Level 1 and Level 2. 1010 * <p> 1011 * @return <code>true</code> if <code>name</code> is one of the five SBML predefined unit 1012 * identifiers (<code>'substance'</code>, <code>'volume'</code>, <code>'area'</code>, <code>'length'</code> or 1013 * <code>'time'</code>), <code>false</code> otherwise. 1014 * <p> 1015 * @note The predefined unit identifiers <code>'length'</code> and <code>'area'</code> were 1016 * added in Level 2 Version 1. 1017 * <p> 1018 * @note Because this is a <em>static</em> method, the 1019 * non-C++ language interfaces for libSBML will contain two variants. One 1020 * will be a static method on the class (i.e., {@link Unit}), and the 1021 * other will be a standalone top-level function with the name 1022 * Unit_isBuiltIn(). They are functionally 1023 * identical. 1024 */ public 1025 static boolean isBuiltIn(String name, long level) { 1026 return libsbmlJNI.Unit_isBuiltIn(name, level); 1027 } 1028 1029 1030/** 1031 * Predicate to test whether a given string is the name of a valid 1032 * base unit in SBML (such as <code>'gram'</code> or <code>'mole'</code>). 1033 * <p> 1034 * This method exists because prior to SBML Level 2 Version 3, 1035 * an enumeration called <code>UnitKind</code> was defined by SBML. This enumeration 1036 * was removed in SBML Level 2 Version 3 and its values were 1037 * folded into the space of values of a type called <code>UnitSId.</code> This method 1038 * therefore has less significance in SBML Level 2 Version 3 1039 * and Level 2 Version 4, but remains for backward 1040 * compatibility and support for reading models in older Versions of 1041 * Level 2. 1042 * <p> 1043 * @param name a string to be tested 1044 * <p> 1045 * @param level a long integer representing the SBML specification 1046 * Level 1047 * <p> 1048 * @param version a long integer representing the SBML specification 1049 * Version 1050 * <p> 1051 * @return <code>true</code> if name is a valid SBML UnitKind, <code>false</code> otherwise 1052 * <p> 1053 * @note The allowed unit names differ between SBML Levels 1 1054 * and 2 and again slightly between Level 2 Versions 1 1055 * and 2. 1056 * <p> 1057 * @note Because this is a <em>static</em> method, the 1058 * non-C++ language interfaces for libSBML will contain two variants. One 1059 * will be a static method on the class (i.e., {@link Unit}), and the 1060 * other will be a standalone top-level function with the name 1061 * Unit_isUnitKind(). They are functionally 1062 * identical. 1063 */ public 1064 static boolean isUnitKind(String name, long level, long version) { 1065 return libsbmlJNI.Unit_isUnitKind(name, level, version); 1066 } 1067 1068 1069/** 1070 * Predicate returning <code>true</code> if two 1071 * {@link Unit} objects are identical. 1072 * <p> 1073 * Two {@link Unit} objects are considered to be <em>identical</em> if they match in 1074 * all attributes. (Contrast this to the method areEquivalent(* {@link Unit} u1, Unit u2), which compares {@link Unit} objects only with respect 1075 * to certain attributes.) 1076 * <p> 1077 * @param unit1 the first {@link Unit} object to compare 1078 * @param unit2 the second {@link Unit} object to compare 1079 * <p> 1080 * @return <code>true</code> if all the attributes of unit1 are identical 1081 * to the attributes of unit2, <code>false</code> otherwise. 1082 * <p> 1083 * @note Because this is a <em>static</em> method, the 1084 * non-C++ language interfaces for libSBML will contain two variants. One 1085 * will be a static method on the class (i.e., {@link Unit}), and the 1086 * other will be a standalone top-level function with the name 1087 * Unit_areIdentical(). They are functionally 1088 * identical. 1089 * <p> 1090 * @see Unit#areEquivalent(Unit u1, Unit u2) 1091 */ public 1092 static boolean areIdentical(Unit unit1, Unit unit2) { 1093 return libsbmlJNI.Unit_areIdentical(Unit.getCPtr(unit1), unit1, Unit.getCPtr(unit2), unit2); 1094 } 1095 1096 1097/** 1098 * Predicate returning <code>true</code> if 1099 * {@link Unit} objects are equivalent. 1100 * <p> 1101 * Two {@link Unit} objects are considered to be <em>equivalent</em> either if (1) both 1102 * have a 'kind' attribute value of <code>dimensionless</code>, or (2) their 'kind', 1103 * 'exponent' and (for SBML Level 2 Version 1) 'offset' 1104 * attribute values are equal. (Contrast this to the method 1105 * areIdentical(Unit u1, Unit u2), which compares {@link Unit} objects with respect to all 1106 * attributes, not just the 'kind' and 'exponent'.) 1107 * <p> 1108 * @param unit1 the first {@link Unit} object to compare 1109 * @param unit2 the second {@link Unit} object to compare 1110 * <p> 1111 * @return <code>true</code> if the 'kind' and 'exponent' attributes of unit1 are 1112 * identical to the kind and exponent attributes of unit2, <code>false</code> 1113 * otherwise. 1114 * <p> 1115 * @note Because this is a <em>static</em> method, the 1116 * non-C++ language interfaces for libSBML will contain two variants. One 1117 * will be a static method on the class (i.e., {@link Unit}), and the 1118 * other will be a standalone top-level function with the name 1119 * Unit_areEquivalent(). They are functionally 1120 * identical. 1121 * <p> 1122 * @see Unit#areIdentical(Unit u1, Unit u2) 1123 */ public 1124 static boolean areEquivalent(Unit unit1, Unit unit2) { 1125 return libsbmlJNI.Unit_areEquivalent(Unit.getCPtr(unit1), unit1, Unit.getCPtr(unit2), unit2); 1126 } 1127 1128 1129/** 1130 * Manipulates the attributes of the {@link Unit} to express the unit with the 1131 * value of the scale attribute reduced to zero. 1132 * <p> 1133 * For example, 1 millimetre can be expressed as a {@link Unit} with kind= 1134 * <code>'metre'</code> multiplier=<code>'1'</code> scale=<code>'-3'</code> exponent=<code>'1'.</code> It can also be 1135 * expressed as a {@link Unit} with kind=<code>'metre'</code> 1136 * multiplier=<code>'0.001'</code> scale=<code>'0'</code> exponent=<code>'1'.</code> 1137 * <p> 1138 * @param unit the {@link Unit} object to manipulate. 1139 * <p> 1140 * @return integer value indicating success/failure of the function. The 1141 * possible values returned by this function are: 1142 * <ul> 1143 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1144 * </ul> 1145 * <p> 1146 * @note Because this is a <em>static</em> method, the 1147 * non-C++ language interfaces for libSBML will contain two variants. One 1148 * will be a static method on the class (i.e., {@link Unit}), and the 1149 * other will be a standalone top-level function with the name 1150 * Unit_removeScale(). They are functionally 1151 * identical. 1152 * <p> 1153 * @see Unit#convertToSI(Unit u) 1154 * @see Unit#merge(Unit u1, Unit u2) 1155 */ public 1156 static int removeScale(Unit unit) { 1157 return libsbmlJNI.Unit_removeScale(Unit.getCPtr(unit), unit); 1158 } 1159 1160 1161/** 1162 * Merges two {@link Unit} objects with the same 'kind' attribute value into a 1163 * single {@link Unit}. 1164 * <p> 1165 * For example, the following, 1166 * <div class='fragment'><pre> 1167 <unit kind='metre' exponent='2'/> 1168 <unit kind='metre' exponent='1'/> 1169 </pre></div> 1170 * would be merged to become 1171 * <div class='fragment'><pre> 1172 <unit kind='metre' exponent='3'/> 1173 </pre></div> 1174 * <p> 1175 * @param unit1 the first {@link Unit} object; the result of the operation is 1176 * left as a new version of this unit, modified in-place. 1177 * <p> 1178 * @param unit2 the second {@link Unit} object to merge with the first 1179 * <p> 1180 * @note Because this is a <em>static</em> method, the 1181 * non-C++ language interfaces for libSBML will contain two variants. One 1182 * will be a static method on the class (i.e., {@link Unit}), and the 1183 * other will be a standalone top-level function with the name 1184 * Unit_merge(). They are functionally 1185 * identical. 1186 * <p> 1187 * @see Unit#convertToSI(Unit u) 1188 * @see Unit#removeScale(Unit u) 1189 */ public 1190 static void merge(Unit unit1, Unit unit2) { 1191 libsbmlJNI.Unit_merge(Unit.getCPtr(unit1), unit1, Unit.getCPtr(unit2), unit2); 1192 } 1193 1194 1195/** 1196 * Returns a {@link UnitDefinition} object containing the given <code>unit</code> converted 1197 * to the appropriate SI unit. 1198 * <p> 1199 * This method exists because some units can be expressed in terms of 1200 * others when the same physical dimension is involved. For example, one 1201 * hertz is identical to 1 sec<sup>-1</sup>, one litre is equivalent 1202 * to 1 cubic decametre, and so on. 1203 * <p> 1204 * @param unit the {@link Unit} object to convert to SI 1205 * <p> 1206 * @return a {@link UnitDefinition} object containing the SI unit. 1207 * <p> 1208 * @note Because this is a <em>static</em> method, the 1209 * non-C++ language interfaces for libSBML will contain two variants. One 1210 * will be a static method on the class (i.e., {@link Unit}), and the 1211 * other will be a standalone top-level function with the name 1212 * Unit_convertToSI(). They are functionally 1213 * identical. 1214 * <p> 1215 * @see Unit#merge(Unit u1, Unit u2) 1216 */ public 1217 static UnitDefinition convertToSI(Unit unit) { 1218 long cPtr = libsbmlJNI.Unit_convertToSI(Unit.getCPtr(unit), unit); 1219 return (cPtr == 0) ? null : new UnitDefinition(cPtr, true); 1220 } 1221 1222 1223/** 1224 * Predicate returning <code>true</code> if 1225 * all the required attributes for this {@link Unit} object 1226 * have been set. 1227 * <p> 1228 * @note The required attributes for a {@link Unit} object are: 1229 * <ul> 1230 * <li> 'kind' 1231 * <li> 'exponent' (required in SBML Level 3; optional in Level 2) 1232 * <li> 'multiplier' (required in SBML Level 3; optional in Level 2) 1233 * <li> 'scale' (required in SBML Level 3; optional in Level 2) 1234 * </ul> 1235 * <p> 1236 * @return a boolean value indicating whether all the required 1237 * elements for this object have been defined. 1238 */ public 1239 boolean hasRequiredAttributes() { 1240 return libsbmlJNI.Unit_hasRequiredAttributes(swigCPtr, this); 1241 } 1242 1243}