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