001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.12 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 * Implementation of SBML's Compartment construct. 013 <p> 014 * A compartment in SBML represents a bounded space in which species are 015 * located. Compartments do not necessarily have to correspond to actual 016 * structures inside or outside of a biological cell. 017 <p> 018 * It is important to note that although compartments are optional in the 019 * overall definition of {@link Model}, every species in an SBML model must be 020 * located in a compartment. This in turn means that if a model defines 021 * any species, the model must also define at least one compartment. The 022 * reason is simply that species represent physical things, and therefore 023 * must exist <em>somewhere</em>. Compartments represent the <em>somewhere</em>. 024 <p> 025 * {@link Compartment} has one required attribute, 'id', to give the compartment a 026 * unique identifier by which other parts of an SBML model definition can 027 * refer to it. A compartment can also have an optional 'name' attribute 028 * of type <code>string.</code> Identifiers and names must be used according to the 029 * guidelines described in the SBML specifications. 030 <p> 031 * {@link Compartment} also has an optional attribute 'spatialDimensions' that is 032 * used to indicate the number of spatial dimensions possessed by the 033 * compartment. Most modeling scenarios involve compartments with integer 034 * values of 'spatialDimensions' of <code>3</code> (i.e., a three-dimensional 035 * compartment, which is to say, a volume), or 2 (a two-dimensional 036 * compartment, a surface), or <code>1</code> (a one-dimensional compartment, a 037 * line). In SBML Level 3, the type of this attribute is <code>double</code>, 038 * there are no restrictions on the permitted values of the 039 * 'spatialDimensions' attribute, and there are no default values. In SBML 040 * Level 2, the value must be a positive <code>integer</code>, and the default 041 * value is <code>3</code>; the permissible values in SBML Level 2 are <code>3</code>, 042 * <code>2</code>, <code>1</code>, and <code>0</code> (for a point). 043 <p> 044 * Another optional attribute on {@link Compartment} is 'size', representing the 045 * <em>initial</em> total size of that compartment in the model. The 'size' attribute 046 * must be a floating-point value and may represent a volume (if the 047 * compartment is a three-dimensional one), or an area (if the compartment is 048 * two-dimensional), or a length (if the compartment is one-dimensional). 049 * There is no default value of compartment size in SBML Level 2 or 050 * Level 3. In particular, a missing 'size' value <em>does not imply 051 * that the compartment size is 1</em>. (This is unlike the definition of 052 * compartment 'volume' in SBML Level 1.) When the compartment's 053 * 'spatialDimensions' attribute does not have a value of <code>0</code>, a missing 054 * value of 'size' for a given compartment signifies that the value either is 055 * unknown, or to be obtained from an external source, or determined by an 056 * {@link InitialAssignment}, {@link AssignmentRule}, {@link AlgebraicRule} or {@link RateRule} 057 * object elsewhere in the model. In SBML 058 * Level 2, there are additional special requirements on the values of 059 * 'size'; we discuss them in a <a href='#comp-l2'>separate section 060 * below</a>. 061 <p> 062 * The units associated with a compartment's 'size' attribute value may be 063 * set using the optional attribute 'units'. The rules for setting and 064 * using compartment size units differ between SBML Level 2 and 065 * Level 3, and are discussed separately below. 066 <p> 067 * Finally, the optional {@link Compartment} attribute named 'constant' is used to 068 * indicate whether the compartment's size stays constant after simulation 069 * begins. A value of <code>true</code> indicates the compartment's 'size' cannot be 070 * changed by any other construct except {@link InitialAssignment}; a value of 071 * <code>false</code> indicates the compartment's 'size' can be changed by other 072 * constructs in SBML. In SBML Level 2, there is an additional 073 * explicit restriction that if 'spatialDimensions'=<code>'0'</code>, the value 074 * cannot be changed by {@link InitialAssignment} either. Further, in 075 * Level 2, 'constant' has a default value of <code>true.</code> In SBML 076 * Level 3, there is no default value for the 'constant' attribute. 077 <p> 078 <p> 079 * <h2>Additional considerations in SBML Level 2</h2> 080 <p> 081 * In SBML Level 2, the default units of compartment size, and the kinds 082 * of units allowed as values of the attribute 'units', interact with the 083 * number of spatial dimensions of the compartment. The value of the 'units' 084 * attribute of a {@link Compartment} object must 085 * be one of the base units (see {@link Unit}), or the predefined unit identifiers 086 * <code>volume</code>, <code>area</code>, <code>length</code> or <code>dimensionless</code>, or a new unit defined by a 087 * {@link UnitDefinition} object in the enclosing 088 * {@link Model}, subject to the restrictions detailed in the following table: 089 <p> 090 * <table border='0' class='centered text-table width80 normal-font alt-row-colors' 091 * style='padding-bottom: 0.5em'> 092 * <caption class='top-caption'>Restrictions on values permitted for 093 * compartment <code>size</code> and <code>units</code> attributes.</caption> 094 * <tr> 095 * <th align='left' valign='bottom'> 096 * Value of<br><code>spatialDimensions</code> 097 * </th> 098 * <th align='left' valign='bottom'> 099 * <code>size</code><br>allowed? 100 * </th> 101 * <th align='left' valign='bottom'> 102 * <code>units</code><br>allowed? 103 * </th> 104 * <th align='left' valign='bottom'> 105 * Allowable kinds of units 106 * </th> 107 * <th align='left' valign='bottom'> 108 * Default value of attribute <code>units</code> 109 * </th> 110 * </tr> 111 * <tr> 112 * <td><code>3</code></td> 113 * <td>yes</td> 114 * <td>yes</td> 115 * <td>units of volume, or <code>dimensionless</code></td> 116 * <td><code>volume</code></td> 117 * </tr> 118 * <tr> 119 * <td><code>2</code></td> 120 * <td>yes</td> 121 * <td>yes</td> 122 * <td>units of area, or <code>dimensionless</code></td> 123 * <td><code>area</code></td> 124 * </tr> 125 * <tr> 126 * <td><code>1</code></td> 127 * <td>yes</td> 128 * <td>yes</td> 129 * <td>units of length, or <code>dimensionless</code></td> 130 * <td><code>length</code></td> 131 * </tr> 132 * <tr> 133 * <td><code>0</code></td> 134 * <td>no</td> 135 * <td>no</td> 136 * <td>(no units allowed)</td> 137 * <td></td> 138 * </tr> 139 * </tr> 140 * </table> 141 <p> 142 * In SBML Level 2, the units of the compartment size, as defined by the 143 * 'units' attribute or (if 'units' is not set) the default value listed in 144 * the table above, are used in the following ways when the compartment has 145 * a 'spatialDimensions' value greater than <code>0:</code> 146 * <ul> 147 * <li> The value of the 'units' attribute is used as the units of the 148 * compartment identifier when the identifier appears as a numerical 149 * quantity in a mathematical formula expressed in MathML. 150 <p> 151 * <li> The <code>math</code> element of an {@link AssignmentRule} or {@link InitialAssignment} 152 * referring to this compartment must have identical units. 153 <p> 154 * <li> In {@link RateRule} objects that set the rate of change of the compartment's 155 * size, the units of the rule's <code>math</code> element must be identical to the 156 * compartment's 'units' attribute divided by the default <em>time</em> units. 157 * (In other words, the units for the rate of change of compartment size 158 * are <em>compartment size</em>/<em>time</em> units. 159 <p> 160 * <li> When a {@link Species} is to be treated in terms of concentrations or 161 * density, the units of the spatial size portion of the concentration 162 * value (i.e., the denominator in the units formula <em>substance</em>/ 163 * <em>size</em>) are those indicated by the value of the 'units' attribute on the 164 * compartment in which the species is located. 165 * </ul> 166 <p> 167 * Compartments with 'spatialDimensions'=<code>0</code> require special treatment in 168 * this framework. As implied above, the 'size' attribute must not have a 169 * value on an SBML Level 2 {@link Compartment} 170 * object if the 'spatialDimensions' 171 * attribute has a value of <code>0.</code> An additional related restriction is that 172 * the 'constant' attribute must default to or be set to <code>true</code> if the value 173 * of the 'spatialDimensions' attribute is <code>0</code>, because a zero-dimensional 174 * compartment cannot ever have a size. 175 <p> 176 * If a compartment has no size or dimensional units, how should such a 177 * compartment's identifier be interpreted when it appears in mathematical 178 * formulas? The answer is that such a compartment's identifier should not 179 * appear in mathematical formulas in the first place—it has no 180 * value, and its value cannot change. Note also that a zero-dimensional 181 * compartment is a point, and species located at points can only be 182 * described in terms of amounts, not spatially-dependent measures such as 183 * concentration. Since SBML {@link KineticLaw} formulas are already in terms of 184 * <em>substance</em>/<em>time</em> and not (say) <em>concentration</em>/<em>time</em>, volume 185 * or other factors in principle are not needed for species located in 186 * zero-dimensional compartments. 187 <p> 188 * Finally, in SBML Level 2 Versions 2–4, each compartment in a 189 * model may optionally be designated as belonging to a particular 190 * compartment <em>type</em>. The optional attribute 'compartmentType' is used 191 * identify the compartment type represented by the {@link Compartment} structure. 192 * The 'compartmentType' attribute's value must be the identifier of a 193 * {@link CompartmentType} instance defined in the model. If the 'compartmentType' 194 * attribute is not present on a particular compartment definition, a 195 * unique virtual compartment type is assumed for that compartment, and no 196 * other compartment can belong to that compartment type. The values of 197 * 'compartmentType' attributes on compartments have no effect on the 198 * numerical interpretation of a model. Simulators and other numerical 199 * analysis software may ignore 'compartmentType' attributes. The 200 * 'compartmentType' attribute and the {@link CompartmentType} 201 * class of objects are 202 * not present in SBML Level 3 Core nor in SBML Level 1. 203 <p> 204 <p> 205 * <h2>Additional considerations in SBML Level 3</h2> 206 <p> 207 * One difference between SBML Level 3 and lower Levels of SBML is 208 * that there are no restrictions on the permissible values of the 209 * 'spatialDimensions' attribute, and there is no default value defined for 210 * the attribute. The value of 'spatialDimensions' does not have to be an 211 * integer, either; this is to allow for the possibility of representing 212 * structures with fractal dimensions. 213 <p> 214 * The number of spatial dimensions possessed by a compartment cannot enter 215 * into mathematical formulas, and therefore cannot directly alter the 216 * numerical interpretation of a model. However, the value of 217 * 'spatialDimensions' <em>does</em> affect the interpretation of the units 218 * associated with a compartment's size. Specifically, the value of 219 * 'spatialDimensions' is used to select among the {@link Model} attributes 220 * 'volumeUnits', 'areaUnits' and 'lengthUnits' when a {@link Compartment} 221 * structure does not define a value for its 222 * 'units' attribute. 223 <p> 224 * The 'units' attribute may be left unspecified for a given compartment in a 225 * model; in that case, the compartment inherits the unit of measurement 226 * specified by one of the attributes on the enclosing {@link Model} 227 * object instance. The applicable 228 * attribute on {@link Model} depends on the value of the compartment's 229 * 'spatialDimensions' attribute; the relationship is shown in the table 230 * below. If the {@link Model} object does not 231 * define the relevant attribute ('volumeUnits', 'areaUnits' or 232 * 'lengthUnits') for a given 'spatialDimensions' value, the unit associated 233 * with that {@link Compartment} object's size is 234 * undefined. If <em>both</em> 'spatialDimensions' and 'units' are left unset on 235 * a given {@link Compartment} object instance, 236 * then no unit can be chosen from among the {@link Model}'s 'volumeUnits', 237 * 'areaUnits' or 'lengthUnits' attributes (even if the {@link Model} instance 238 * provides values for those attributes), because there is no basis to select 239 * between them and there is no default value of 'spatialDimensions'. 240 * Leaving the units of compartments' sizes undefined in an SBML model does 241 * not render the model invalid; however, as a matter of best practice, we 242 * strongly recommend that all models specify the units of measurement for 243 * all compartment sizes. 244 <p> 245 * <table border='0' class='centered text-table width80 normal-font alt-row-colors' 246 * style='padding-bottom: 0.5em'> 247 * <caption class='top-caption'>Interpretation of the {@link Compartment} 'units' attribute.</caption> 248 * <tr> 249 * <th align='left' valign='bottom'> 250 * Value of attribute<br>'spatialDimensions' 251 * </th> 252 * <th align='left' valign='bottom'> 253 * Attribute of {@link Model} used<br>for inheriting the unit 254 * </th> 255 * <th align='left' valign='bottom'> 256 * Recommended candidate units 257 * </th> 258 * </tr> 259 * <tr> 260 * <td><code>3</code></td> 261 * <td>"volumeUnits"</td> 262 * <td>units of volume, or <code>dimensionless</code></td> 263 * </tr> 264 * <tr> 265 * <td><code>2</code></td> 266 * <td>"areaUnits"</td> 267 * <td>units of area, or <code>dimensionless</code></td> 268 * </tr> 269 * <tr> 270 * <td><code>1</code></td> 271 * <td>"lengthUnits"</td> 272 * <td>units of length, or <code>dimensionless</code></td> 273 * </tr> 274 * <tr> 275 * <td><em>other</em></td> 276 * <td><em>no units inherited</em></td> 277 * <td><em>no specific recommendations</em></td> 278 * </tr> 279 * </tr> 280 * </table> 281 <p> 282 * The unit of measurement associated with a compartment's size, as defined 283 * by the 'units' attribute or (if 'units' is not set) the inherited value 284 * from {@link Model} according to the table above, is used in the following ways: 285 <p> 286 * <ul> 287 <p> 288 * <li> When the identifier of the compartment appears as a numerical 289 * quantity in a mathematical formula expressed in MathML, it represents 290 * the size of the compartment, and the unit associated with the size is 291 * the value of the 'units' attribute. 292 <p> 293 * <li> When a {@link Species} is to be treated in terms of concentrations or 294 * density, the unit associated with the spatial size portion of the 295 * concentration value (i.e., the denominator in the formula 296 * <em>amount</em>/<em>size</em>) is specified by the value of the 'units' 297 * attribute on the compartment in which the species is located. 298 <p> 299 * <li> The 'math' elements of {@link AssignmentRule}, {@link InitialAssignment} and 300 * {@link EventAssignment} objects setting the 301 * value of the compartment size should all have the same units as the unit 302 * associated with the compartment's size. 303 <p> 304 * <li> In a {@link RateRule} object that defines a 305 * rate of change for a compartment's size, the unit of the rule's 'math' 306 * element should be identical to the compartment's 'units' attribute divided 307 * by the model-wide unit of <em>time</em>. (In other words, {<em>unit of 308 * compartment size</em>}/{<em>unit of time</em>}.) 309 <p> 310 * </ul> 311 <p> 312 <p> 313 * <h2>Other aspects of {@link Compartment}</h2> 314 <p> 315 * In SBML Level 1 and Level 2, {@link Compartment} has an optional 316 * attribute named 'outside', whose value can be the identifier of another 317 * {@link Compartment} object defined in the 318 * enclosing {@link Model} object. Doing so means 319 * that the other compartment contains it or is outside of it. This enables 320 * the representation of simple topological relationships between 321 * compartments, for those simulation systems that can make use of the 322 * information (e.g., for drawing simple diagrams of compartments). It is 323 * worth noting that in SBML, there is no relationship between compartment 324 * sizes when compartment positioning is expressed using the 'outside' 325 * attribute. The size of a given compartment does not in any sense include 326 * the sizes of other compartments having it as the value of their 'outside' 327 * attributes. In other words, if a compartment <em>B</em> has the identifier of 328 * compartment <em>A</em> as its 'outside' attribute value, the size of <em>A</em> does 329 * not include the size of <em>B</em>. The compartment sizes are separate. 330 <p> 331 * In Level 2, there are two restrictions on the 'outside' attribute. 332 * First, because a compartment with 'spatialDimensions' of <code>0</code> has no 333 * size, such a compartment cannot act as the container of any other 334 * compartment <em>except</em> compartments that <em>also</em> have 335 * 'spatialDimensions' values of <code>0.</code> Second, the directed graph formed 336 * by representing {@link Compartment} structures as vertexes and the 'outside' 337 * attribute values as edges must be acyclic. The latter condition is 338 * imposed to prevent a compartment from being contained inside itself. In 339 * the absence of a value for 'outside', compartment definitions in SBML 340 * Level 2 do not have any implied spatial relationships between each 341 * other. 342 */ 343 344public class Compartment extends SBase { 345 private long swigCPtr; 346 347 protected Compartment(long cPtr, boolean cMemoryOwn) 348 { 349 super(libsbmlJNI.Compartment_SWIGUpcast(cPtr), cMemoryOwn); 350 swigCPtr = cPtr; 351 } 352 353 protected static long getCPtr(Compartment obj) 354 { 355 return (obj == null) ? 0 : obj.swigCPtr; 356 } 357 358 protected static long getCPtrAndDisown (Compartment obj) 359 { 360 long ptr = 0; 361 362 if (obj != null) 363 { 364 ptr = obj.swigCPtr; 365 obj.swigCMemOwn = false; 366 } 367 368 return ptr; 369 } 370 371 protected void finalize() { 372 delete(); 373 } 374 375 public synchronized void delete() { 376 if (swigCPtr != 0) { 377 if (swigCMemOwn) { 378 swigCMemOwn = false; 379 libsbmlJNI.delete_Compartment(swigCPtr); 380 } 381 swigCPtr = 0; 382 } 383 super.delete(); 384 } 385 386 387/** 388 * Creates a new {@link Compartment} using the given SBML <code>level</code> and <code>version</code> 389 * values. 390 <p> 391 * @param level a long integer, the SBML Level to assign to this {@link Compartment} 392 <p> 393 * @param version a long integer, the SBML Version to assign to this 394 * {@link Compartment} 395 <p> 396 * @throws SBMLConstructorException 397 * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind 398 * of SBML object, are either invalid or mismatched with respect to the 399 * parent {@link SBMLDocument} object. 400 <p> 401 * <p> 402 * @note Upon the addition of a {@link Compartment} object to an {@link SBMLDocument}, 403 * the SBML Level, SBML Version and XML namespace of the document 404 * <em>override</em> the values used when creating the {@link Compartment} object via the 405 * {@link Compartment} constructors. This is necessary to ensure that an SBML 406 * document has a consistent overall structure. Nevertheless, the ability to 407 * supply the values at the time of creation of a {@link Compartment} is an important 408 * aid to producing valid SBML. Knowledge of the intented SBML Level and 409 * Version determine whether it is valid to assign a particular value to an 410 * attribute, or whether it is valid to add an object to an existing 411 * {@link SBMLDocument}. 412 */ public 413 Compartment(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 414 this(libsbmlJNI.new_Compartment__SWIG_0(level, version), true); 415 } 416 417 418/** 419 * Creates a new {@link Compartment} using the given {@link SBMLNamespaces} object 420 * <code>sbmlns</code>. 421 <p> 422 * <p> 423 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 424 * information. It is used to communicate the SBML Level, Version, and (in 425 * Level 3) packages used in addition to SBML Level 3 Core. A 426 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 427 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 428 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 429 <p> 430 * It is worth emphasizing that although this constructor does not take 431 * an identifier argument, in SBML Level 2 and beyond, the 'id' 432 * (identifier) attribute of a {@link Compartment} is required to have a value. 433 * Thus, callers are cautioned to assign a value after calling this 434 * constructor. Setting the identifier can be accomplished using the 435 * method {@link Compartment#setId(String id)}. 436 <p> 437 * @param sbmlns an {@link SBMLNamespaces} object. 438 <p> 439 * @throws SBMLConstructorException 440 * Thrown if the given <code>level</code> and <code>version</code> combination, or this kind 441 * of SBML object, are either invalid or mismatched with respect to the 442 * parent {@link SBMLDocument} object. 443 <p> 444 * <p> 445 * @note Upon the addition of a {@link Compartment} object to an {@link SBMLDocument}, 446 * the SBML Level, SBML Version and XML namespace of the document 447 * <em>override</em> the values used when creating the {@link Compartment} object via the 448 * {@link Compartment} constructors. This is necessary to ensure that an SBML 449 * document has a consistent overall structure. Nevertheless, the ability to 450 * supply the values at the time of creation of a {@link Compartment} is an important 451 * aid to producing valid SBML. Knowledge of the intented SBML Level and 452 * Version determine whether it is valid to assign a particular value to an 453 * attribute, or whether it is valid to add an object to an existing 454 * {@link SBMLDocument}. 455 */ public 456 Compartment(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 457 this(libsbmlJNI.new_Compartment__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 458 } 459 460 461/** 462 * Copy constructor; creates a copy of a {@link Compartment}. 463 <p> 464 * @param orig the {@link Compartment} instance to copy. 465 <p> 466 * @throws SBMLConstructorException 467 * Thrown if the argument <code>orig</code> is <code>null.</code> 468 */ public 469 Compartment(Compartment orig) throws org.sbml.libsbml.SBMLConstructorException { 470 this(libsbmlJNI.new_Compartment__SWIG_2(Compartment.getCPtr(orig), orig), true); 471 } 472 473 474/** 475 * Creates and returns a deep copy of this {@link Compartment} object. 476 <p> 477 * @return a (deep) copy of this {@link Compartment}. 478 */ public 479 Compartment cloneObject() { 480 long cPtr = libsbmlJNI.Compartment_cloneObject(swigCPtr, this); 481 return (cPtr == 0) ? null : new Compartment(cPtr, true); 482 } 483 484 485/** 486 * Initializes the fields of this {@link Compartment} object to 'typical' default 487 * values. 488 <p> 489 * The SBML {@link Compartment} component has slightly different aspects and 490 * default attribute values in different SBML Levels and Versions. 491 * This method sets the values to certain common defaults, based 492 * mostly on what they are in SBML Level 2. Specifically: 493 <p> 494 * <ul> 495 * <li> Sets attribute 'spatialDimensions' to <code>3</code> 496 * <li> Sets attribute 'constant' to <code>true</code> 497 * <li> (Applies to Level 1 models only) Sets attribute 'volume' to <code>1.0</code> 498 * <li> (Applies to Level 3 models only) Sets attribute 'units' to <code>litre</code> 499 * </ul> 500 */ public 501 void initDefaults() { 502 libsbmlJNI.Compartment_initDefaults(swigCPtr, this); 503 } 504 505 506/** 507 * Returns the value of the 'id' attribute of this {@link Compartment} object. 508 <p> 509 * @return the id of this {@link Compartment}. 510 */ public 511 String getId() { 512 return libsbmlJNI.Compartment_getId(swigCPtr, this); 513 } 514 515 516/** 517 * Returns the value of the 'name' attribute of this {@link Compartment} object. 518 <p> 519 * @return the name of this {@link Compartment}. 520 */ public 521 String getName() { 522 return libsbmlJNI.Compartment_getName(swigCPtr, this); 523 } 524 525 526/** 527 * Get the value of the 'compartmentType' attribute of this {@link Compartment} 528 * object. 529 <p> 530 * @return the value of the 'compartmentType' attribute of this 531 * {@link Compartment} as a string. 532 <p> 533 * @note The 'compartmentType' attribute is only available in SBML 534 * Level 2 Versions 2–4. 535 */ public 536 String getCompartmentType() { 537 return libsbmlJNI.Compartment_getCompartmentType(swigCPtr, this); 538 } 539 540 541/** 542 * Get the number of spatial dimensions of this {@link Compartment} object. 543 <p> 544 * @return the value of the 'spatialDimensions' attribute of this 545 * {@link Compartment} as a long integereger 546 <p> 547 * <p> 548 * @note In SBML Level 3, the data type of the 'spatialDimensions' 549 * attribute is <code>"</code>;double", whereas in Level 2, it is 550 * <code>"</code>;integer". To avoid backward compatibility issues, libSBML 551 * provides two separate methods for obtaining the value as either an 552 * integer or a type <code>double</code>, for models where it is relevant. 553 <p> 554 * @see #getSpatialDimensionsAsDouble() 555 */ public 556 long getSpatialDimensions() { 557 return libsbmlJNI.Compartment_getSpatialDimensions(swigCPtr, this); 558 } 559 560 561/** 562 * Get the number of spatial dimensions of this {@link Compartment} object, 563 * as a double. 564 <p> 565 * @return the value of the 'spatialDimensions' attribute of this 566 * {@link Compartment} as a double, or <code>NaN</code> if this model is not in SBML 567 * Level 3 format. 568 <p> 569 * <p> 570 * @note In SBML Level 3, the data type of the 'spatialDimensions' 571 * attribute is <code>"</code>;double", whereas in Level 2, it is 572 * <code>"</code>;integer". To avoid backward compatibility issues, libSBML 573 * provides two separate methods for obtaining the value as either an 574 * integer or a type <code>double</code>, for models where it is relevant. 575 <p> 576 * @see #getSpatialDimensions() 577 */ public 578 double getSpatialDimensionsAsDouble() { 579 return libsbmlJNI.Compartment_getSpatialDimensionsAsDouble(swigCPtr, this); 580 } 581 582 583/** 584 * Get the size of this {@link Compartment}. 585 <p> 586 * <p> 587 * In SBML Level 1, compartments are always three-dimensional 588 * constructs and only have volumes, whereas in SBML Level 2 and higher, 589 * compartments may be other than three-dimensional, and therefore the 590 * 'volume' attribute is named 'size' in Level 2 and above. LibSBML 591 * provides both 592 * {@link Compartment#getSize()} and {@link Compartment#getVolume()} 593 * for easier support of different SBML Levels. 594 <p> 595 * @return the value of the 'size' attribute ('volume' in Level 1) of 596 * this {@link Compartment} as a floating-point number. 597 <p> 598 * @note This method is identical to 599 * {@link Compartment#getVolume()}. 600 <p> 601 * @see #isSetSize() 602 * @see #getVolume() 603 */ public 604 double getSize() { 605 return libsbmlJNI.Compartment_getSize(swigCPtr, this); 606 } 607 608 609/** 610 * Get the volume of this {@link Compartment}. 611 <p> 612 * <p> 613 * In SBML Level 1, compartments are always three-dimensional 614 * constructs and only have volumes, whereas in SBML Level 2 and higher, 615 * compartments may be other than three-dimensional, and therefore the 616 * 'volume' attribute is named 'size' in Level 2 and above. LibSBML 617 * provides both 618 * {@link Compartment#getSize()} and {@link Compartment#getVolume()} 619 * for easier support of different SBML Levels. 620 <p> 621 * @return the value of the 'volume' attribute ('size' in Level 2) of 622 * this {@link Compartment}, as a floating-point number. 623 <p> 624 * <p> 625 * @note The attribute 'volume' only exists by that name in SBML 626 * Level 1. In Level 2 and above, the equivalent attribute is 627 * named 'size'. In SBML Level 1, a compartment's volume has a default 628 * value (<code>1.0</code>) and therefore methods such as 629 * {@link Compartment#isSetVolume()} 630 * will always return <code>true</code> for a Level 1 model. In Level 2, a 631 * compartment's size (the equivalent of SBML Level 1's 'volume') is 632 * optional and has no default value, and therefore may or may not be set. 633 <p> 634 * @note This method is identical to 635 * {@link Compartment#getSize()}. 636 <p> 637 * @see #isSetVolume() 638 * @see #getSize() 639 */ public 640 double getVolume() { 641 return libsbmlJNI.Compartment_getVolume(swigCPtr, this); 642 } 643 644 645/** 646 * Get the units of this compartment's size. 647 <p> 648 * The value of an SBML compartment's 'units' attribute establishes the 649 * unit of measurement associated with the compartment's size. 650 <p> 651 * @return the value of the 'units' attribute of this {@link Compartment}, as a 652 * string. An empty string indicates that no units have been assigned to 653 * the value of the size. 654 <p> 655 * <p> 656 * @note There is an important distinction to be made between <em>no units 657 * assigned</em>, and assuming a value without units has any specific unit 658 * such as <code>dimensionless</code>. In SBML, default units are never 659 * attributed to numbers, and numbers without units are not automatically 660 * assumed to have the unit <code>dimensionless</code>. Please consult the 661 * relevant SBML specification document for a more in-depth explanation of 662 * this topic and the SBML unit system. 663 <p> 664 * @see #isSetUnits() 665 * @see Compartment#setUnits(String sid) 666 * @see #getSize() 667 */ public 668 String getUnits() { 669 return libsbmlJNI.Compartment_getUnits(swigCPtr, this); 670 } 671 672 673/** 674 * Get the identifier, if any, of the compartment that is designated 675 * as being outside of this one. 676 <p> 677 * @return the value of the 'outside' attribute of this {@link Compartment}. 678 <p> 679 * @note The 'outside' attribute is defined in SBML Level 1 and 680 * Level 2, but does not exist in SBML Level 3 Version 1 681 * Core. 682 */ public 683 String getOutside() { 684 return libsbmlJNI.Compartment_getOutside(swigCPtr, this); 685 } 686 687 688/** 689 * Get the value of the 'constant' attribute of this {@link Compartment}. 690 <p> 691 * @return <code>true</code> if this {@link Compartment}'s size is flagged as being 692 * constant, <code>false</code> otherwise. 693 */ public 694 boolean getConstant() { 695 return libsbmlJNI.Compartment_getConstant(swigCPtr, this); 696 } 697 698 699/** 700 * Predicate returning <code>true</code> if this 701 * {@link Compartment}'s 'id' attribute is set. 702 <p> 703 * @return <code>true</code> if the 'id' attribute of this {@link Compartment} is 704 * set, <code>false</code> otherwise. 705 */ public 706 boolean isSetId() { 707 return libsbmlJNI.Compartment_isSetId(swigCPtr, this); 708 } 709 710 711/** 712 * Predicate returning <code>true</code> if this 713 * {@link Compartment}'s 'name' attribute is set. 714 <p> 715 * @return <code>true</code> if the 'name' attribute of this {@link Compartment} is 716 * set, <code>false</code> otherwise. 717 */ public 718 boolean isSetName() { 719 return libsbmlJNI.Compartment_isSetName(swigCPtr, this); 720 } 721 722 723/** 724 * Predicate returning <code>true</code> if this 725 * {@link Compartment}'s 'compartmentType' attribute is set. 726 <p> 727 * @return <code>true</code> if the 'compartmentType' attribute of this {@link Compartment} 728 * is set, <code>false</code> otherwise. 729 <p> 730 * @note The 'compartmentType' attribute is only available in SBML 731 * Level 2 Versions 2–4. 732 */ public 733 boolean isSetCompartmentType() { 734 return libsbmlJNI.Compartment_isSetCompartmentType(swigCPtr, this); 735 } 736 737 738/** 739 * Predicate returning <code>true</code> if this {@link Compartment}'s 'size' attribute is 740 * set. 741 <p> 742 * This method is similar but not identical to 743 * {@link Compartment#isSetVolume()}. The latter 744 * should be used in the context of SBML Level 1 models instead of 745 * {@link Compartment#isSetSize()} 746 * because {@link Compartment#isSetVolume()} 747 * performs extra processing to take into account the difference in 748 * default values between SBML Levels 1 and 2. 749 <p> 750 * @return <code>true</code> if the 'size' attribute ('volume' in Level 2) of 751 * this {@link Compartment} is set, <code>false</code> otherwise. 752 <p> 753 * @see #isSetVolume() 754 * @see Compartment#setSize(double value) 755 */ public 756 boolean isSetSize() { 757 return libsbmlJNI.Compartment_isSetSize(swigCPtr, this); 758 } 759 760 761/** 762 * Predicate returning <code>true</code> if this {@link Compartment}'s 'volume' attribute is 763 * set. 764 <p> 765 * This method is similar but not identical to 766 * {@link Compartment#isSetSize()}. The latter 767 * should not be used in the context of SBML Level 1 models because the 768 * present method performs extra processing to take into account 769 * the difference in default values between SBML Levels 1 and 2. 770 <p> 771 * @return <code>true</code> if the 'volume' attribute ('size' in Level 2 and 772 * above) of this {@link Compartment} is set, <code>false</code> otherwise. 773 <p> 774 * <p> 775 * @note The attribute 'volume' only exists by that name in SBML 776 * Level 1. In Level 2 and above, the equivalent attribute is 777 * named 'size'. In SBML Level 1, a compartment's volume has a default 778 * value (<code>1.0</code>) and therefore methods such as 779 * {@link Compartment#isSetVolume()} 780 * will always return <code>true</code> for a Level 1 model. In Level 2, a 781 * compartment's size (the equivalent of SBML Level 1's 'volume') is 782 * optional and has no default value, and therefore may or may not be set. 783 <p> 784 * @see #isSetSize() 785 * @see Compartment#setVolume(double value) 786 */ public 787 boolean isSetVolume() { 788 return libsbmlJNI.Compartment_isSetVolume(swigCPtr, this); 789 } 790 791 792/** 793 * Predicate returning <code>true</code> if this 794 * {@link Compartment}'s 'units' attribute is set. 795 <p> 796 * @return <code>true</code> if the 'units' attribute of this {@link Compartment} is 797 * set, <code>false</code> otherwise. 798 <p> 799 * <p> 800 * @note There is an important distinction to be made between <em>no units 801 * assigned</em>, and assuming a value without units has any specific unit 802 * such as <code>dimensionless</code>. In SBML, default units are never 803 * attributed to numbers, and numbers without units are not automatically 804 * assumed to have the unit <code>dimensionless</code>. Please consult the 805 * relevant SBML specification document for a more in-depth explanation of 806 * this topic and the SBML unit system. 807 */ public 808 boolean isSetUnits() { 809 return libsbmlJNI.Compartment_isSetUnits(swigCPtr, this); 810 } 811 812 813/** 814 * Predicate returning <code>true</code> if this 815 * {@link Compartment}'s 'outside' attribute is set. 816 <p> 817 * @return <code>true</code> if the 'outside' attribute of this {@link Compartment} is 818 * set, <code>false</code> otherwise. 819 <p> 820 * @note The 'outside' attribute is defined in SBML Level 1 and 821 * Level 2, but does not exist in SBML Level 3 Version 1 822 * Core. 823 */ public 824 boolean isSetOutside() { 825 return libsbmlJNI.Compartment_isSetOutside(swigCPtr, this); 826 } 827 828 829/** 830 * Predicate returning <code>true</code> if this 831 * {@link Compartment}'s 'spatialDimensions' attribute is set. 832 <p> 833 * @return <code>true</code> if the 'spatialDimensions' attribute of this 834 * {@link Compartment} is set, <code>false</code> otherwise. 835 */ public 836 boolean isSetSpatialDimensions() { 837 return libsbmlJNI.Compartment_isSetSpatialDimensions(swigCPtr, this); 838 } 839 840 841/** 842 * Predicate returning <code>true</code> if this 843 * {@link Compartment}'s 'constant' attribute is set. 844 <p> 845 * @return <code>true</code> if the 'constant' attribute of this {@link Compartment} is 846 * set, <code>false</code> otherwise. 847 */ public 848 boolean isSetConstant() { 849 return libsbmlJNI.Compartment_isSetConstant(swigCPtr, this); 850 } 851 852 853/** 854 * Sets the value of the 'id' attribute of this {@link Compartment}. 855 <p> 856 * The string <code>sid</code> is copied. 857 <p> 858 * <p> 859 * SBML has strict requirements for the syntax of identifiers, that is, the 860 * values of the 'id' attribute present on most types of SBML objects. 861 * The following is a summary of the definition of the SBML identifier type 862 * <code>SId</code>, which defines the permitted syntax of identifiers. We 863 * express the syntax using an extended form of BNF notation: 864 * <pre style='margin-left: 2em; border: none; font-weight: bold; font-size: 13px; color: black'> 865 * letter .= 'a'..'z','A'..'Z' 866 * digit .= '0'..'9' 867 * idChar .= letter | digit | '_' 868 * SId .= ( letter | '_' ) idChar* 869 * </pre> 870 * The characters <code>(</code> and <code>)</code> are used for grouping, the 871 * character <code>*</code> 'zero or more times', and the character 872 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers is 873 * determined by an exact character sequence match; i.e., comparisons must be 874 * performed in a case-sensitive manner. In addition, there are a few 875 * conditions for the uniqueness of identifiers in an SBML model. Please 876 * consult the SBML specifications for the exact details of the uniqueness 877 * requirements. 878 <p> 879 * @param sid the string to use as the identifier of this {@link Compartment}. If 880 * the string is <code>null</code>, this method will return 881 * {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }. 882 <p> 883 * @return integer value indicating success/failure of the 884 * function. The possible values 885 * returned by this function are: 886 * <ul> 887 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 888 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 889 * </ul> 890 */ public 891 int setId(String sid) { 892 return libsbmlJNI.Compartment_setId(swigCPtr, this, sid); 893 } 894 895 896/** 897 * Sets the value of the 'name' attribute of this {@link Compartment}. 898 <p> 899 * The string in <code>name</code> is copied. 900 <p> 901 * @param name the new name for the {@link Compartment}. If the string is <code>null</code>, 902 * this method will return 903 * {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }. 904 <p> 905 * @return integer value indicating success/failure of the 906 * function. The possible values 907 * returned by this function are: 908 * <ul> 909 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 910 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 911 * </ul> 912 */ public 913 int setName(String name) { 914 return libsbmlJNI.Compartment_setName(swigCPtr, this, name); 915 } 916 917 918/** 919 * Sets the 'compartmentType' attribute of this {@link Compartment}. 920 <p> 921 * @param sid the identifier of a {@link CompartmentType} object defined elsewhere 922 * in this {@link Model}. If the string is <code>null</code>, this method will return 923 * {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }. 924 <p> 925 * @return integer value indicating success/failure of the 926 * function. The possible values 927 * returned by this function are: 928 * <ul> 929 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 930 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 931 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 932 * 933 * </ul> <p> 934 * @note The 'compartmentType' attribute is only available in SBML 935 * Level 2 Versions 2–4. 936 */ public 937 int setCompartmentType(String sid) { 938 return libsbmlJNI.Compartment_setCompartmentType(swigCPtr, this, sid); 939 } 940 941 942/** 943 * Sets the 'spatialDimensions' attribute of this {@link Compartment}. 944 <p> 945 * @param value a long integereger indicating the number of dimensions 946 * of this compartment. 947 <p> 948 * @return integer value indicating success/failure of the 949 * function. The possible values 950 * returned by this function are: 951 * <ul> 952 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 953 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 954 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 955 * </ul> 956 */ public 957 int setSpatialDimensions(long value) { 958 return libsbmlJNI.Compartment_setSpatialDimensions__SWIG_0(swigCPtr, this, value); 959 } 960 961 962/** 963 * Sets the 'spatialDimensions' attribute of this {@link Compartment} as a double. 964 <p> 965 * @param value a double indicating the number of dimensions 966 * of this compartment. 967 <p> 968 * @return integer value indicating success/failure of the 969 * function. The possible values 970 * returned by this function are: 971 * <ul> 972 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 973 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 974 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 975 * </ul> 976 */ public 977 int setSpatialDimensions(double value) { 978 return libsbmlJNI.Compartment_setSpatialDimensions__SWIG_1(swigCPtr, this, value); 979 } 980 981 982/** 983 * Sets the 'size' attribute (or 'volume' in SBML Level 1) of this 984 * {@link Compartment}. 985 <p> 986 * @param value a <code>double</code> representing the size of this compartment 987 * instance in whatever units are in effect for the compartment. 988 <p> 989 * @return integer value indicating success/failure of the 990 * function. The possible values 991 * returned by this function are: 992 * <ul> 993 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 994 * 995 * </ul> <p> 996 * @note This method is identical to 997 * {@link Compartment#setVolume(double value)}. 998 <p> 999 * @see #isSetSize() 1000 * @see Compartment#setVolume(double value) 1001 */ public 1002 int setSize(double value) { 1003 return libsbmlJNI.Compartment_setSize(swigCPtr, this, value); 1004 } 1005 1006 1007/** 1008 * Sets the 'volume' attribute (or 'size' in SBML Level 2) of this 1009 * {@link Compartment}. 1010 <p> 1011 * This method is identical to 1012 * {@link Compartment#setSize(double value)} 1013 * and is provided for compatibility between SBML Level 1 and 1014 * higher Levels of SBML. 1015 <p> 1016 * @param value a <code>double</code> representing the volume of this compartment 1017 * instance in whatever units are in effect for the compartment. 1018 <p> 1019 * @return integer value indicating success/failure of the 1020 * function. The possible values 1021 * returned by this function are: 1022 * <ul> 1023 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1024 * 1025 * </ul> <p> 1026 * <p> 1027 * @note The attribute 'volume' only exists by that name in SBML 1028 * Level 1. In Level 2 and above, the equivalent attribute is 1029 * named 'size'. In SBML Level 1, a compartment's volume has a default 1030 * value (<code>1.0</code>) and therefore methods such as 1031 * {@link Compartment#isSetVolume()} 1032 * will always return <code>true</code> for a Level 1 model. In Level 2, a 1033 * compartment's size (the equivalent of SBML Level 1's 'volume') is 1034 * optional and has no default value, and therefore may or may not be set. 1035 <p> 1036 * @see #isSetVolume() 1037 * @see Compartment#setSize(double value) 1038 */ public 1039 int setVolume(double value) { 1040 return libsbmlJNI.Compartment_setVolume(swigCPtr, this, value); 1041 } 1042 1043 1044/** 1045 * Sets the 'units' attribute of this {@link Compartment}. 1046 <p> 1047 * @param sid the identifier of the defined units to use. If <code>sid</code> is 1048 * <code>null</code>, then this method will return 1049 * {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }. 1050 <p> 1051 * @return integer value indicating success/failure of the 1052 * function. The possible values 1053 * returned by this function are: 1054 * <ul> 1055 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1056 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 1057 * </ul> 1058 */ public 1059 int setUnits(String sid) { 1060 return libsbmlJNI.Compartment_setUnits(swigCPtr, this, sid); 1061 } 1062 1063 1064/** 1065 * Sets the 'outside' attribute of this {@link Compartment}. 1066 <p> 1067 * @param sid the identifier of a compartment that encloses this one. If 1068 * <code>sid</code> is <code>null</code>, then this method will return 1069 * {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE }. 1070 <p> 1071 * @return integer value indicating success/failure of the 1072 * function. The possible values 1073 * returned by this function are: 1074 * <ul> 1075 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1076 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE } 1077 * 1078 * </ul> <p> 1079 * @note The 'outside' attribute is defined in SBML Level 1 and 1080 * Level 2, but does not exist in SBML Level 3 Version 1 1081 * Core. 1082 */ public 1083 int setOutside(String sid) { 1084 return libsbmlJNI.Compartment_setOutside(swigCPtr, this, sid); 1085 } 1086 1087 1088/** 1089 * Sets the value of the 'constant' attribute of this {@link Compartment}. 1090 <p> 1091 * @param value a boolean indicating whether the size/volume of this 1092 * compartment should be considered constant (<code>true</code>) or variable 1093 * (<code>false</code>). 1094 <p> 1095 * @return integer value indicating success/failure of the 1096 * function. The possible values 1097 * returned by this function are: 1098 * <ul> 1099 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1100 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 1101 * </ul> 1102 */ public 1103 int setConstant(boolean value) { 1104 return libsbmlJNI.Compartment_setConstant(swigCPtr, this, value); 1105 } 1106 1107 1108/** 1109 * Renames all the <code>SIdRef</code> attributes on this element, including any 1110 * found in MathML. 1111 <p> 1112 * <p> 1113 * In SBML, object identifiers are of a data type called <code>SId</code>. 1114 * In SBML Level 3, an explicit data type called <code>SIdRef</code> was 1115 * introduced for attribute values that refer to <code>SId</code> values; in 1116 * previous Levels of SBML, this data type did not exist and attributes were 1117 * simply described to as 'referring to an identifier', but the effective 1118 * data type was the same as <code>SIdRef</code>in Level 3. These and 1119 * other methods of libSBML refer to the type <code>SIdRef</code> for all 1120 * Levels of SBML, even if the corresponding SBML specification did not 1121 * explicitly name the data type. 1122 <p> 1123 * This method works by looking at all attributes and (if appropriate) 1124 * mathematical formulas, comparing the identifiers to the value of 1125 * <code>oldid</code>. If any matches are found, the matching identifiers are replaced 1126 * with <code>newid</code>. The method does <em>not</em> descend into child elements. 1127 <p> 1128 * @param oldid the old identifier 1129 * @param newid the new identifier 1130 */ public 1131 void renameSIdRefs(String oldid, String newid) { 1132 libsbmlJNI.Compartment_renameSIdRefs(swigCPtr, this, oldid, newid); 1133 } 1134 1135 1136/** 1137 * Renames all the <code>UnitSIdRef</code> attributes on this element. 1138 <p> 1139 * <p> 1140 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>. In 1141 * SBML Level 3, an explicit data type called <code>UnitSIdRef</code> was 1142 * introduced for attribute values that refer to <code>UnitSId</code> values; in 1143 * previous Levels of SBML, this data type did not exist and attributes were 1144 * simply described to as 'referring to a unit identifier', but the effective 1145 * data type was the same as <code>UnitSIdRef</code> in Level 3. These and 1146 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all 1147 * Levels of SBML, even if the corresponding SBML specification did not 1148 * explicitly name the data type. 1149 <p> 1150 * This method works by looking at all unit identifier attribute values 1151 * (including, if appropriate, inside mathematical formulas), comparing the 1152 * unit identifiers to the value of <code>oldid</code>. If any matches are found, 1153 * the matching identifiers are replaced with <code>newid</code>. The method does 1154 * <em>not</em> descend into child elements. 1155 <p> 1156 * @param oldid the old identifier 1157 * @param newid the new identifier 1158 */ public 1159 void renameUnitSIdRefs(String oldid, String newid) { 1160 libsbmlJNI.Compartment_renameUnitSIdRefs(swigCPtr, this, oldid, newid); 1161 } 1162 1163 1164/** 1165 * Unsets the value of the 'name' attribute of this {@link Compartment}. 1166 <p> 1167 * @return integer value indicating success/failure of the 1168 * function. The possible values 1169 * returned by this function are: 1170 * <ul> 1171 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1172 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 1173 * </ul> 1174 */ public 1175 int unsetName() { 1176 return libsbmlJNI.Compartment_unsetName(swigCPtr, this); 1177 } 1178 1179 1180/** 1181 * Unsets the value of the 'compartmentType' attribute of this {@link Compartment}. 1182 <p> 1183 * @return integer value indicating success/failure of the 1184 * function. The possible values 1185 * returned by this function are: 1186 * <ul> 1187 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1188 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 1189 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 1190 * 1191 * </ul> <p> 1192 * @note The 'compartmentType' attribute is only available in SBML 1193 * Level 2 Versions 2–4. 1194 <p> 1195 * @see #setCompartmentType(String sid) 1196 * @see #isSetCompartmentType() 1197 */ public 1198 int unsetCompartmentType() { 1199 return libsbmlJNI.Compartment_unsetCompartmentType(swigCPtr, this); 1200 } 1201 1202 1203/** 1204 * Unsets the value of the 'size' attribute of this {@link Compartment}. 1205 <p> 1206 * In SBML Level 1, a compartment's volume has a default value ( 1207 * <code>1.0</code>) and therefore <em>should always be set</em>. Calling this method 1208 * on a Level 1 model resets the value to <code>1.0</code> rather than actually 1209 * unsetting it. In Level 2, a compartment's 'size' is optional with 1210 * no default value, and unsetting it will result in the compartment having 1211 * no defined size. 1212 <p> 1213 * @return integer value indicating success/failure of the 1214 * function. The possible values 1215 * returned by this function are: 1216 * <ul> 1217 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1218 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 1219 * 1220 * </ul> <p> 1221 * @note This method is identical to 1222 * {@link Compartment#unsetVolume()}. 1223 */ public 1224 int unsetSize() { 1225 return libsbmlJNI.Compartment_unsetSize(swigCPtr, this); 1226 } 1227 1228 1229/** 1230 * Unsets the value of the 'volume' attribute of this {@link Compartment}. 1231 <p> 1232 * This method is identical to 1233 * {@link Compartment#unsetSize()}. Please refer 1234 * to that method's documentation for more information about its behavior. 1235 <p> 1236 * @return integer value indicating success/failure of the 1237 * function. The possible values 1238 * returned by this function are: 1239 * <ul> 1240 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1241 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 1242 * 1243 * </ul> <p> 1244 * <p> 1245 * @note The attribute 'volume' only exists by that name in SBML 1246 * Level 1. In Level 2 and above, the equivalent attribute is 1247 * named 'size'. In SBML Level 1, a compartment's volume has a default 1248 * value (<code>1.0</code>) and therefore methods such as 1249 * {@link Compartment#isSetVolume()} 1250 * will always return <code>true</code> for a Level 1 model. In Level 2, a 1251 * compartment's size (the equivalent of SBML Level 1's 'volume') is 1252 * optional and has no default value, and therefore may or may not be set. 1253 <p> 1254 * @see #unsetSize() 1255 */ public 1256 int unsetVolume() { 1257 return libsbmlJNI.Compartment_unsetVolume(swigCPtr, this); 1258 } 1259 1260 1261/** 1262 * Unsets the value of the 'units' attribute of this {@link Compartment}. 1263 <p> 1264 * @return integer value indicating success/failure of the 1265 * function. The possible values 1266 * returned by this function are: 1267 * <ul> 1268 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1269 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 1270 * </ul> 1271 */ public 1272 int unsetUnits() { 1273 return libsbmlJNI.Compartment_unsetUnits(swigCPtr, this); 1274 } 1275 1276 1277/** 1278 * Unsets the value of the 'outside' attribute of this {@link Compartment}. 1279 <p> 1280 * @return integer value indicating success/failure of the 1281 * function. The possible values 1282 * returned by this function are: 1283 * <ul> 1284 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1285 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 1286 * 1287 * </ul> <p> 1288 * @note The 'outside' attribute is defined in SBML Level 1 and 1289 * Level 2, but does not exist in SBML Level 3 Version 1 1290 * Core. 1291 */ public 1292 int unsetOutside() { 1293 return libsbmlJNI.Compartment_unsetOutside(swigCPtr, this); 1294 } 1295 1296 1297/** 1298 * Unsets the value of the 'spatialDimensions' attribute of this 1299 * {@link Compartment}. 1300 <p> 1301 * In SBML Levels prior to Level 3, compartments must always have a 1302 * value for the number of dimensions. Consequently, calling this method 1303 * on a model of SBML Level 1–2 will result in a return value of 1304 * {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 1305 <p> 1306 * @return integer value indicating success/failure of the 1307 * function. The possible values 1308 * returned by this function are: 1309 * <ul> 1310 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS } 1311 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED } 1312 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE } 1313 * 1314 * </ul> <p> 1315 * @note This function is only valid for SBML Level 3. 1316 */ public 1317 int unsetSpatialDimensions() { 1318 return libsbmlJNI.Compartment_unsetSpatialDimensions(swigCPtr, this); 1319 } 1320 1321 1322/** 1323 * Constructs and returns a {@link UnitDefinition} that corresponds to the units 1324 * of this {@link Compartment}'s designated size. 1325 <p> 1326 * <p> 1327 * Compartments in SBML have an attribute ('units') for declaring the 1328 * units of measurement intended for the value of the compartment's size. In 1329 * the absence of a value given for this attribute, the units are inherited 1330 * from values either defined on the enclosing {@link Model} (in SBML Level 3) 1331 * or in defaults (in SBML Level 2). This method returns a 1332 * {@link UnitDefinition} object 1333 * based on how this compartment's units are interpreted according to the 1334 * relevant SBML guidelines, or it returns <code>null</code> if no units have been 1335 * declared and no defaults are defined by the relevant SBML specification. 1336 <p> 1337 * Note that unit declarations for 1338 * {@link Compartment} objects 1339 * are specified in terms of the <em>identifier</em> of a unit, 1340 * but <em>this</em> method returns an object , 1341 * not a unit identifier. It does this by constructing an appropriate 1342 * {@link UnitDefinition} object. For 1343 * SBML Level 2 models, it will do this even when the value of the 1344 * 'units' attribute is one of the special SBML Level 2 unit identifiers 1345 * <code>'substance'</code>, <code>'volume'</code>, <code>'area'</code>, <code>'length'</code> or <code>'time'.</code> Callers 1346 * may find this useful in conjunction with the helper methods provided by 1347 * the {@link UnitDefinition} 1348 * class for comparing different {@link UnitDefinition} objects. 1349 <p> 1350 * @return a {@link UnitDefinition} that expresses the units of this 1351 * {@link Compartment}, or <code>null</code> if one cannot be constructed. 1352 <p> 1353 * <p> 1354 * @note The libSBML system for unit analysis depends on the model as a 1355 * whole. In cases where the 1356 * {@link Compartment} object has not 1357 * yet been added to a model, or the model itself is incomplete, unit 1358 * analysis is not possible, and consequently this method will return 1359 * <code>null.</code> 1360 <p> 1361 * @see #isSetUnits() 1362 * @see #getUnits() 1363 */ public 1364 UnitDefinition getDerivedUnitDefinition() { 1365 long cPtr = libsbmlJNI.Compartment_getDerivedUnitDefinition__SWIG_0(swigCPtr, this); 1366 return (cPtr == 0) ? null : new UnitDefinition(cPtr, false); 1367 } 1368 1369 1370/** 1371 * Returns the libSBML type code for this SBML object. 1372 <p> 1373 * <p> 1374 * LibSBML attaches an identifying code to every kind of SBML object. These 1375 * are integer constants known as <em>SBML type codes</em>. The names of all 1376 * the codes begin with the characters “<code>SBML_</code>”. 1377 * In the Java language interface for libSBML, the 1378 * type codes are defined as static integer constants in the interface class 1379 * {@link libsbmlConstants}. Note that different Level 3 1380 * package plug-ins may use overlapping type codes; to identify the package 1381 * to which a given object belongs, call the <code>getPackageName()</code> 1382 * method on the object. 1383 <p> 1384 * @return the SBML type code for this object: 1385 * {@link libsbmlConstants#SBML_COMPARTMENT SBML_COMPARTMENT} (default). 1386 <p> 1387 * <p> 1388 * @warning <span class='warning'>The specific integer values of the possible 1389 * type codes may be reused by different Level 3 package plug-ins. 1390 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 1391 * both getTypeCode() and getPackageName()</strong>.</span> 1392 <p> 1393 * @see #getElementName() 1394 * @see #getPackageName() 1395 */ public 1396 int getTypeCode() { 1397 return libsbmlJNI.Compartment_getTypeCode(swigCPtr, this); 1398 } 1399 1400 1401/** 1402 * Returns the XML element name of this object, which for {@link Compartment}, is 1403 * always <code>'compartment'.</code> 1404 <p> 1405 * @return the name of this element, i.e., <code>'compartment'.</code> 1406 */ public 1407 String getElementName() { 1408 return libsbmlJNI.Compartment_getElementName(swigCPtr, this); 1409 } 1410 1411 1412/** 1413 * Predicate returning <code>true</code> if all the required attributes for this 1414 * {@link Compartment} object have been set. 1415 <p> 1416 * @note The required attributes for a {@link Compartment} object are: 1417 * <ul> 1418 * <li> 'id' (or 'name' in SBML Level 1) 1419 * <li> 'constant' (in SBML Level 3 only) 1420 * 1421 * </ul> <p> 1422 * @return a boolean value indicating whether all the required 1423 * attributes for this object have been defined. 1424 */ public 1425 boolean hasRequiredAttributes() { 1426 return libsbmlJNI.Compartment_hasRequiredAttributes(swigCPtr, this); 1427 } 1428 1429}