public class Compartment extends SBase
A compartment in SBML represents a bounded space in which species are located. Compartments do not necessarily have to correspond to actual structures inside or outside of a biological cell.
It is important to note that although compartments are optional in the
overall definition of Model
, every species in an SBML model must be
located in a compartment. This in turn means that if a model defines
any species, the model must also define at least one compartment. The
reason is simply that species represent physical things, and therefore
must exist somewhere. Compartments represent the somewhere.
Compartment
has one required attribute, 'id', to give the compartment a
unique identifier by which other parts of an SBML model definition can
refer to it. A compartment can also have an optional 'name' attribute
of type string.
Identifiers and names must be used according to the
guidelines described in the SBML specifications.
Compartment
also has an optional attribute 'spatialDimensions' that is
used to indicate the number of spatial dimensions possessed by the
compartment. Most modeling scenarios involve compartments with integer
values of 'spatialDimensions' of 3
(i.e., a three-dimensional
compartment, which is to say, a volume), or 2 (a two-dimensional
compartment, a surface), or 1
(a one-dimensional compartment, a
line). In SBML Level 3, the type of this attribute is double
,
there are no restrictions on the permitted values of the
'spatialDimensions' attribute, and there are no default values. In SBML
Level 2, the value must be a positive integer
, and the default
value is 3
the permissible values in SBML Level 2 are 3
,
2
, 1
, and 0
(for a point).
Another optional attribute on Compartment
is 'size', representing the
initial total size of that compartment in the model. The 'size' attribute
must be a floating-point value and may represent a volume (if the
compartment is a three-dimensional one), or an area (if the compartment is
two-dimensional), or a length (if the compartment is one-dimensional).
There is no default value of compartment size in SBML Level 2 or
Level 3. In particular, a missing 'size' value does not imply
that the compartment size is 1. (This is unlike the definition of
compartment 'volume' in SBML Level 1.) When the compartment's
'spatialDimensions' attribute does not have a value of 0
, a missing
value of 'size' for a given compartment signifies that the value either is
unknown, or to be obtained from an external source, or determined by an
InitialAssignment
, AssignmentRule
, AlgebraicRule
or RateRule
object elsewhere in the model. In SBML
Level 2, there are additional special requirements on the values of
'size' we discuss them in a separate section
below.
The units associated with a compartment's 'size' attribute value may be set using the optional attribute 'units'. The rules for setting and using compartment size units differ between SBML Level 2 and Level 3, and are discussed separately below.
Finally, the optional Compartment
attribute named 'constant' is used to
indicate whether the compartment's size stays constant after simulation
begins. A value of true
indicates the compartment's 'size' cannot be
changed by any other construct except InitialAssignment
a value of
false
indicates the compartment's 'size' can be changed by other
constructs in SBML. In SBML Level 2, there is an additional
explicit restriction that if 'spatialDimensions'='0'
, the value
cannot be changed by InitialAssignment
either. Further, in
Level 2, 'constant' has a default value of true.
In SBML
Level 3, there is no default value for the 'constant' attribute.
In SBML Level 2, the default units of compartment size, and the kinds
of units allowed as values of the attribute 'units', interact with the
number of spatial dimensions of the compartment. The value of the 'units'
attribute of a Compartment
object must
be one of the base units (see Unit
), or the predefined unit identifiers
volume
, area
, length
or dimensionless
, or a new unit defined by a
UnitDefinition
object in the enclosing
Model
, subject to the restrictions detailed in the following table:
Value ofspatialDimensions
|
size allowed? |
units allowed? |
Allowable kinds of units |
Default value of attribute units
|
---|---|---|---|---|
3 |
yes | yes | units of volume, or dimensionless |
volume |
2 |
yes | yes | units of area, or dimensionless |
area |
1 |
yes | yes | units of length, or dimensionless |
length |
0 |
no | no | (no units allowed) |
In SBML Level 2, the units of the compartment size, as defined by the
'units' attribute or (if 'units' is not set) the default value listed in
the table above, are used in the following ways when the compartment has
a 'spatialDimensions' value greater than 0:
math
element of an AssignmentRule
or InitialAssignment
referring to this compartment must have identical units.
RateRule
objects that set the rate of change of the compartment's
size, the units of the rule's math
element must be identical to the
compartment's 'units' attribute divided by the default time units.
(In other words, the units for the rate of change of compartment size
are compartment size/time units.
Species
is to be treated in terms of concentrations or
density, the units of the spatial size portion of the concentration
value (i.e., the denominator in the units formula substance/
size) are those indicated by the value of the 'units' attribute on the
compartment in which the species is located.
Compartments with 'spatialDimensions'=0
require special treatment in
this framework. As implied above, the 'size' attribute must not have a
value on an SBML Level 2 Compartment
object if the 'spatialDimensions'
attribute has a value of 0.
An additional related restriction is that
the 'constant' attribute must default to or be set to true
if the value
of the 'spatialDimensions' attribute is 0
, because a zero-dimensional
compartment cannot ever have a size.
If a compartment has no size or dimensional units, how should such a
compartment's identifier be interpreted when it appears in mathematical
formulas? The answer is that such a compartment's identifier should not
appear in mathematical formulas in the first place&mdashit has no
value, and its value cannot change. Note also that a zero-dimensional
compartment is a point, and species located at points can only be
described in terms of amounts, not spatially-dependent measures such as
concentration. Since SBML KineticLaw
formulas are already in terms of
substance/time and not (say) concentration/time, volume
or other factors in principle are not needed for species located in
zero-dimensional compartments.
Finally, in SBML Level 2 Versions 2&ndash4, each compartment in a
model may optionally be designated as belonging to a particular
compartment type. The optional attribute 'compartmentType' is used
identify the compartment type represented by the Compartment
structure.
The 'compartmentType' attribute's value must be the identifier of a
CompartmentType
instance defined in the model. If the 'compartmentType'
attribute is not present on a particular compartment definition, a
unique virtual compartment type is assumed for that compartment, and no
other compartment can belong to that compartment type. The values of
'compartmentType' attributes on compartments have no effect on the
numerical interpretation of a model. Simulators and other numerical
analysis software may ignore 'compartmentType' attributes. The
'compartmentType' attribute and the CompartmentType
class of objects are
not present in SBML Level 3 Core nor in SBML Level 1.
One difference between SBML Level 3 and lower Levels of SBML is that there are no restrictions on the permissible values of the 'spatialDimensions' attribute, and there is no default value defined for the attribute. The value of 'spatialDimensions' does not have to be an integer, either this is to allow for the possibility of representing structures with fractal dimensions.
The number of spatial dimensions possessed by a compartment cannot enter
into mathematical formulas, and therefore cannot directly alter the
numerical interpretation of a model. However, the value of
'spatialDimensions' does affect the interpretation of the units
associated with a compartment's size. Specifically, the value of
'spatialDimensions' is used to select among the Model
attributes
'volumeUnits', 'areaUnits' and 'lengthUnits' when a Compartment
structure does not define a value for its
'units' attribute.
The 'units' attribute may be left unspecified for a given compartment in a
model in that case, the compartment inherits the unit of measurement
specified by one of the attributes on the enclosing Model
object instance. The applicable
attribute on Model
depends on the value of the compartment's
'spatialDimensions' attribute the relationship is shown in the table
below. If the Model
object does not
define the relevant attribute ('volumeUnits', 'areaUnits' or
'lengthUnits') for a given 'spatialDimensions' value, the unit associated
with that Compartment
object's size is
undefined. If both 'spatialDimensions' and 'units' are left unset on
a given Compartment
object instance,
then no unit can be chosen from among the Model
's 'volumeUnits',
'areaUnits' or 'lengthUnits' attributes (even if the Model
instance
provides values for those attributes), because there is no basis to select
between them and there is no default value of 'spatialDimensions'.
Leaving the units of compartments' sizes undefined in an SBML model does
not render the model invalid however, as a matter of best practice, we
strongly recommend that all models specify the units of measurement for
all compartment sizes.
Value of attribute 'spatialDimensions' |
Attribute of Model usedfor inheriting the unit |
Recommended candidate units |
---|---|---|
3 |
"volumeUnits" | units of volume, or dimensionless |
2 |
"areaUnits" | units of area, or dimensionless |
1 |
"lengthUnits" | units of length, or dimensionless |
other | no units inherited | no specific recommendations |
The unit of measurement associated with a compartment's size, as defined
by the 'units' attribute or (if 'units' is not set) the inherited value
from Model
according to the table above, is used in the following ways:
Species
is to be treated in terms of concentrations or
density, the unit associated with the spatial size portion of the
concentration value (i.e., the denominator in the formula
amount/size) is specified by the value of the 'units'
attribute on the compartment in which the species is located.
AssignmentRule
, InitialAssignment
and
EventAssignment
objects setting the
value of the compartment size should all have the same units as the unit
associated with the compartment's size.
RateRule
object that defines a
rate of change for a compartment's size, the unit of the rule's 'math'
element should be identical to the compartment's 'units' attribute divided
by the model-wide unit of time. (In other words, {unit of
compartment size}/{unit of time}.)
Compartment
In SBML Level 1 and Level 2, Compartment
has an optional
attribute named 'outside', whose value can be the identifier of another
Compartment
object defined in the
enclosing Model
object. Doing so means
that the other compartment contains it or is outside of it. This enables
the representation of simple topological relationships between
compartments, for those simulation systems that can make use of the
information (e.g., for drawing simple diagrams of compartments). It is
worth noting that in SBML, there is no relationship between compartment
sizes when compartment positioning is expressed using the 'outside'
attribute. The size of a given compartment does not in any sense include
the sizes of other compartments having it as the value of their 'outside'
attributes. In other words, if a compartment B has the identifier of
compartment A as its 'outside' attribute value, the size of A does
not include the size of B. The compartment sizes are separate.
In Level 2, there are two restrictions on the 'outside' attribute.
First, because a compartment with 'spatialDimensions' of 0
has no
size, such a compartment cannot act as the container of any other
compartment except compartments that also have
'spatialDimensions' values of 0.
Second, the directed graph formed
by representing Compartment
structures as vertexes and the 'outside'
attribute values as edges must be acyclic. The latter condition is
imposed to prevent a compartment from being contained inside itself. In
the absence of a value for 'outside', compartment definitions in SBML
Level 2 do not have any implied spatial relationships between each
other.
Constructor and Description |
---|
Compartment(Compartment orig)
Copy constructor creates a copy of a
Compartment . |
Compartment(long level,
long version)
|
Compartment(SBMLNamespaces sbmlns)
|
Modifier and Type | Method and Description |
---|---|
Compartment |
cloneObject()
Creates and returns a deep copy of this
Compartment object. |
void |
delete()
Explicitly deletes the underlying native object.
|
java.lang.String |
getCompartmentType()
Get the value of the 'compartmentType' attribute of this
Compartment
object. |
boolean |
getConstant()
Get the value of the 'constant' attribute of this
Compartment . |
UnitDefinition |
getDerivedUnitDefinition()
Constructs and returns a
UnitDefinition that corresponds to the units
of this Compartment 's designated size. |
java.lang.String |
getElementName()
Returns the XML element name of this object, which for
Compartment , is
always 'compartment'. |
java.lang.String |
getId()
Returns the value of the 'id' attribute of this
Compartment object. |
java.lang.String |
getName()
Returns the value of the 'name' attribute of this
Compartment object. |
java.lang.String |
getOutside()
Get the identifier, if any, of the compartment that is designated
as being outside of this one.
|
double |
getSize()
Get the size of this
Compartment . |
long |
getSpatialDimensions()
Get the number of spatial dimensions of this
Compartment object. |
double |
getSpatialDimensionsAsDouble()
Get the number of spatial dimensions of this
Compartment object,
as a double. |
int |
getTypeCode()
Returns the libSBML type code for this SBML object.
|
java.lang.String |
getUnits()
Get the units of this compartment's size.
|
double |
getVolume()
Get the volume of this
Compartment . |
boolean |
hasRequiredAttributes()
Predicate returning
true if all the required attributes for this
Compartment object have been set. |
void |
initDefaults()
Initializes the fields of this
Compartment object to 'typical' default
values. |
boolean |
isSetCompartmentType()
Predicate returning
true if this
Compartment 's 'compartmentType' attribute is set. |
boolean |
isSetConstant()
Predicate returning
true if this
Compartment 's 'constant' attribute is set. |
boolean |
isSetId()
Predicate returning
true if this
Compartment 's 'id' attribute is set. |
boolean |
isSetName()
Predicate returning
true if this
Compartment 's 'name' attribute is set. |
boolean |
isSetOutside()
Predicate returning
true if this
Compartment 's 'outside' attribute is set. |
boolean |
isSetSize()
Predicate returning
true if this Compartment 's 'size' attribute is
set. |
boolean |
isSetSpatialDimensions()
Predicate returning
true if this
Compartment 's 'spatialDimensions' attribute is set. |
boolean |
isSetUnits()
Predicate returning
true if this
Compartment 's 'units' attribute is set. |
boolean |
isSetVolume()
Predicate returning
true if this Compartment 's 'volume' attribute is
set. |
void |
renameSIdRefs(java.lang.String oldid,
java.lang.String newid)
Renames all the
SIdRef attributes on this element, including any
found in MathML. |
void |
renameUnitSIdRefs(java.lang.String oldid,
java.lang.String newid)
Renames all the
UnitSIdRef attributes on this element. |
int |
setCompartmentType(java.lang.String sid)
Sets the 'compartmentType' attribute of this
Compartment . |
int |
setConstant(boolean value)
Sets the value of the 'constant' attribute of this
Compartment . |
int |
setId(java.lang.String sid)
Sets the value of the 'id' attribute of this
Compartment . |
int |
setName(java.lang.String name)
Sets the value of the 'name' attribute of this
Compartment . |
int |
setOutside(java.lang.String sid)
Sets the 'outside' attribute of this
Compartment . |
int |
setSize(double value)
Sets the 'size' attribute (or 'volume' in SBML Level 1) of this
Compartment . |
int |
setSpatialDimensions(double value)
Sets the 'spatialDimensions' attribute of this
Compartment as a double. |
int |
setSpatialDimensions(long value)
Sets the 'spatialDimensions' attribute of this
Compartment . |
int |
setUnits(java.lang.String sid)
Sets the 'units' attribute of this
Compartment . |
int |
setVolume(double value)
Sets the 'volume' attribute (or 'size' in SBML Level 2) of this
Compartment . |
int |
unsetCompartmentType()
Unsets the value of the 'compartmentType' attribute of this
Compartment . |
int |
unsetName()
Unsets the value of the 'name' attribute of this
Compartment . |
int |
unsetOutside()
Unsets the value of the 'outside' attribute of this
Compartment . |
int |
unsetSize()
Unsets the value of the 'size' attribute of this
Compartment . |
int |
unsetSpatialDimensions()
Unsets the value of the 'spatialDimensions' attribute of this
Compartment . |
int |
unsetUnits()
Unsets the value of the 'units' attribute of this
Compartment . |
int |
unsetVolume()
Unsets the value of the 'volume' attribute of this
Compartment . |
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getElementByMetaId, getElementBySId, getLevel, getLine, getListOfAllElements, getListOfAllElements, getListOfAllElementsFromPlugins, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getPrefix, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetId, unsetMetaId, unsetModelHistory, unsetNotes, unsetSBOTerm
public Compartment(Compartment orig) throws SBMLConstructorException
Compartment
.
orig
- the Compartment
instance to copy.
SBMLConstructorException
- Thrown if the argument orig
is null.
public Compartment(long level, long version) throws SBMLConstructorException
level
- a long integer, the SBML Level to assign to this Compartment
version
- a long integer, the SBML Version to assign to this
Compartment
SBMLConstructorException
- Thrown if the given level
and version
combination, or this kind
of SBML object, are either invalid or mismatched with respect to the
parent SBMLDocument
object.
Compartment
object to an SBMLDocument
,
the SBML Level, SBML Version and XML namespace of the document
override the values used when creating the Compartment
object via the
Compartment
constructors. This is necessary to ensure that an SBML
document has a consistent overall structure. Nevertheless, the ability to
supply the values at the time of creation of a Compartment
is an important
aid to producing valid SBML. Knowledge of the intented SBML Level and
Version determine whether it is valid to assign a particular value to an
attribute, or whether it is valid to add an object to an existing
SBMLDocument
.public Compartment(SBMLNamespaces sbmlns) throws SBMLConstructorException
Compartment
using the given SBMLNamespaces
object
sbmlns
.
The SBMLNamespaces
object encapsulates SBML Level/Version/namespaces
information. It is used to communicate the SBML Level, Version, and (in
Level 3) packages used in addition to SBML Level 3 Core. A
common approach to using libSBML's SBMLNamespaces
facilities is to create an
SBMLNamespaces
object somewhere in a program once, then hand that object
as needed to object constructors that accept SBMLNamespaces
as arguments.
It is worth emphasizing that although this constructor does not take
an identifier argument, in SBML Level 2 and beyond, the 'id'
(identifier) attribute of a Compartment
is required to have a value.
Thus, callers are cautioned to assign a value after calling this
constructor. Setting the identifier can be accomplished using the
method Compartment.setId(String id)
.
sbmlns
- an SBMLNamespaces
object.
SBMLConstructorException
- Thrown if the given level
and version
combination, or this kind
of SBML object, are either invalid or mismatched with respect to the
parent SBMLDocument
object.
Compartment
object to an SBMLDocument
,
the SBML Level, SBML Version and XML namespace of the document
override the values used when creating the Compartment
object via the
Compartment
constructors. This is necessary to ensure that an SBML
document has a consistent overall structure. Nevertheless, the ability to
supply the values at the time of creation of a Compartment
is an important
aid to producing valid SBML. Knowledge of the intented SBML Level and
Version determine whether it is valid to assign a particular value to an
attribute, or whether it is valid to add an object to an existing
SBMLDocument
.public Compartment cloneObject()
Compartment
object.
cloneObject
 in class SBase
Compartment
.public void delete()
In general, application software will not need to call this method directly. The Java language binding for libSBML is implemented as a language wrapper that provides a Java interface to libSBML's underlying C++/C code. Some of the Java methods return objects that are linked to objects created not by Java code, but by C++ code. The Java objects wrapped around them will be deleted when the garbage collector invokes the corresponding C++ finalize()
methods for the objects. The finalize()
methods in turn call the Compartment.delete()
method on the libSBML object.
This method is exposed in case calling programs want to ensure that the underlying object is freed immediately, and not at some arbitrary time determined by the Java garbage collector. In normal usage, callers do not need to invoke Compartment.delete()
themselves.
public java.lang.String getCompartmentType()
Compartment
object.
Compartment
as a string.
public boolean getConstant()
Compartment
.
true
if this Compartment
's size is flagged as being
constant, false
otherwise.public UnitDefinition getDerivedUnitDefinition()
UnitDefinition
that corresponds to the units
of this Compartment
's designated size.
Compartments in SBML have an attribute ('units') for declaring the
units of measurement intended for the value of the compartment's size. In
the absence of a value given for this attribute, the units are inherited
from values either defined on the enclosing Model
(in SBML Level 3)
or in defaults (in SBML Level 2). This method returns a
UnitDefinition
object
based on how this compartment's units are interpreted according to the
relevant SBML guidelines, or it returns null
if no units have been
declared and no defaults are defined by the relevant SBML specification.
Note that unit declarations for
Compartment
objects
are specified in terms of the identifier of a unit,
but this method returns an object ,
not a unit identifier. It does this by constructing an appropriate
UnitDefinition
object. For
SBML Level 2 models, it will do this even when the value of the
'units' attribute is one of the special SBML Level 2 unit identifiers
'substance'
, 'volume'
, 'area'
, 'length'
or 'time'.
Callers
may find this useful in conjunction with the helper methods provided by
the UnitDefinition
class for comparing different UnitDefinition
objects.
getDerivedUnitDefinition
 in class SBase
UnitDefinition
that expresses the units of this
Compartment
, or null
if one cannot be constructed.
Compartment.isSetUnits()
,
Compartment.getUnits()
Compartment
object has not
yet been added to a model, or the model itself is incomplete, unit
analysis is not possible, and consequently this method will return
null.
public java.lang.String getElementName()
Compartment
, is
always 'compartment'.
getElementName
 in class SBase
'compartment'.
public java.lang.String getId()
Compartment
object.
getId
 in class SBase
Compartment
.public java.lang.String getName()
Compartment
object.
getName
 in class SBase
Compartment
.public java.lang.String getOutside()
Compartment
.
public double getSize()
Compartment
.
In SBML Level 1, compartments are always three-dimensional
constructs and only have volumes, whereas in SBML Level 2 and higher,
compartments may be other than three-dimensional, and therefore the
'volume' attribute is named 'size' in Level 2 and above. LibSBML
provides both
Compartment.getSize()
and Compartment.getVolume()
for easier support of different SBML Levels.
Compartment
as a floating-point number.
Compartment.isSetSize()
,
Compartment.getVolume()
Compartment.getVolume()
.
public long getSpatialDimensions()
Compartment
object.
Compartment
as a long integereger
Compartment.getSpatialDimensionsAsDouble()
"
double", whereas in Level 2, it is
"
integer". To avoid backward compatibility issues, libSBML
provides two separate methods for obtaining the value as either an
integer or a type double
, for models where it is relevant.
public double getSpatialDimensionsAsDouble()
Compartment
object,
as a double.
Compartment
as a double, or NaN
if this model is not in SBML
Level 3 format.
Compartment.getSpatialDimensions()
"
double", whereas in Level 2, it is
"
integer". To avoid backward compatibility issues, libSBML
provides two separate methods for obtaining the value as either an
integer or a type double
, for models where it is relevant.
public int getTypeCode()
LibSBML attaches an identifying code to every kind of SBML object. These
are integer constants known as SBML type codes. The names of all
the codes begin with the characters &ldquoSBML_
&rdquo.
In the Java language interface for libSBML, the
type codes are defined as static integer constants in the interface class
libsbmlConstants
. Note that different Level 3
package plug-ins may use overlapping type codes to identify the package
to which a given object belongs, call the getPackageName()
method on the object.
getTypeCode
 in class SBase
SBML_COMPARTMENT
(default).
Compartment.getElementName()
,
SBase.getPackageName()
public java.lang.String getUnits()
The value of an SBML compartment's 'units' attribute establishes the unit of measurement associated with the compartment's size.
Compartment
, as a
string. An empty string indicates that no units have been assigned to
the value of the size.
Compartment.isSetUnits()
,
Compartment.setUnits(String sid)
,
Compartment.getSize()
dimensionless
. In SBML, default units are never
attributed to numbers, and numbers without units are not automatically
assumed to have the unit dimensionless
. Please consult the
relevant SBML specification document for a more in-depth explanation of
this topic and the SBML unit system.
public double getVolume()
Compartment
.
In SBML Level 1, compartments are always three-dimensional
constructs and only have volumes, whereas in SBML Level 2 and higher,
compartments may be other than three-dimensional, and therefore the
'volume' attribute is named 'size' in Level 2 and above. LibSBML
provides both
Compartment.getSize()
and Compartment.getVolume()
for easier support of different SBML Levels.
Compartment
, as a floating-point number.
Compartment.isSetVolume()
,
Compartment.getSize()
1.0
) and therefore methods such as
Compartment.isSetVolume()
will always return true
for a Level 1 model. In Level 2, a
compartment's size (the equivalent of SBML Level 1's 'volume') is
optional and has no default value, and therefore may or may not be set.
, This method is identical to
Compartment.getSize()
.
public boolean hasRequiredAttributes()
true
if all the required attributes for this
Compartment
object have been set.
hasRequiredAttributes
 in class SBase
Compartment
object are:
public void initDefaults()
Compartment
object to 'typical' default
values.
The SBML Compartment
component has slightly different aspects and
default attribute values in different SBML Levels and Versions.
This method sets the values to certain common defaults, based
mostly on what they are in SBML Level 2. Specifically:
3
true
1.0
litre
public boolean isSetCompartmentType()
true
if this
Compartment
's 'compartmentType' attribute is set.
true
if the 'compartmentType' attribute of this Compartment
is set, false
otherwise.
public boolean isSetConstant()
true
if this
Compartment
's 'constant' attribute is set.
true
if the 'constant' attribute of this Compartment
is
set, false
otherwise.public boolean isSetId()
true
if this
Compartment
's 'id' attribute is set.
isSetId
 in class SBase
true
if the 'id' attribute of this Compartment
is
set, false
otherwise.public boolean isSetName()
true
if this
Compartment
's 'name' attribute is set.
isSetName
 in class SBase
true
if the 'name' attribute of this Compartment
is
set, false
otherwise.public boolean isSetOutside()
true
if this
Compartment
's 'outside' attribute is set.
true
if the 'outside' attribute of this Compartment
is
set, false
otherwise.
public boolean isSetSize()
true
if this Compartment
's 'size' attribute is
set.
This method is similar but not identical to
Compartment.isSetVolume()
. The latter
should be used in the context of SBML Level 1 models instead of
Compartment.isSetSize()
because Compartment.isSetVolume()
performs extra processing to take into account the difference in
default values between SBML Levels 1 and 2.
true
if the 'size' attribute ('volume' in Level 2) of
this Compartment
is set, false
otherwise.
Compartment.isSetVolume()
,
Compartment.setSize(double value)
public boolean isSetSpatialDimensions()
true
if this
Compartment
's 'spatialDimensions' attribute is set.
true
if the 'spatialDimensions' attribute of this
Compartment
is set, false
otherwise.public boolean isSetUnits()
true
if this
Compartment
's 'units' attribute is set.
true
if the 'units' attribute of this Compartment
is
set, false
otherwise.
dimensionless
. In SBML, default units are never
attributed to numbers, and numbers without units are not automatically
assumed to have the unit dimensionless
. Please consult the
relevant SBML specification document for a more in-depth explanation of
this topic and the SBML unit system.public boolean isSetVolume()
true
if this Compartment
's 'volume' attribute is
set.
This method is similar but not identical to
Compartment.isSetSize()
. The latter
should not be used in the context of SBML Level 1 models because the
present method performs extra processing to take into account
the difference in default values between SBML Levels 1 and 2.
true
if the 'volume' attribute ('size' in Level 2 and
above) of this Compartment
is set, false
otherwise.
Compartment.isSetSize()
,
Compartment.setVolume(double value)
1.0
) and therefore methods such as
Compartment.isSetVolume()
will always return true
for a Level 1 model. In Level 2, a
compartment's size (the equivalent of SBML Level 1's 'volume') is
optional and has no default value, and therefore may or may not be set.
public void renameSIdRefs(java.lang.String oldid, java.lang.String newid)
SIdRef
attributes on this element, including any
found in MathML.
In SBML, object identifiers are of a data type called SId
.
In SBML Level 3, an explicit data type called SIdRef
was
introduced for attribute values that refer to SId
values in
previous Levels of SBML, this data type did not exist and attributes were
simply described to as 'referring to an identifier', but the effective
data type was the same as SIdRef
in Level 3. These and
other methods of libSBML refer to the type SIdRef
for all
Levels of SBML, even if the corresponding SBML specification did not
explicitly name the data type.
This method works by looking at all attributes and (if appropriate)
mathematical formulas, comparing the identifiers to the value of
oldid
. If any matches are found, the matching identifiers are replaced
with newid
. The method does not descend into child elements.
renameSIdRefs
 in class SBase
oldid
- the old identifiernewid
- the new identifierpublic void renameUnitSIdRefs(java.lang.String oldid, java.lang.String newid)
UnitSIdRef
attributes on this element.
In SBML, unit definitions have identifiers of type UnitSId
. In
SBML Level 3, an explicit data type called UnitSIdRef
was
introduced for attribute values that refer to UnitSId
values in
previous Levels of SBML, this data type did not exist and attributes were
simply described to as 'referring to a unit identifier', but the effective
data type was the same as UnitSIdRef
in Level 3. These and
other methods of libSBML refer to the type UnitSIdRef
for all
Levels of SBML, even if the corresponding SBML specification did not
explicitly name the data type.
This method works by looking at all unit identifier attribute values
(including, if appropriate, inside mathematical formulas), comparing the
unit identifiers to the value of oldid
. If any matches are found,
the matching identifiers are replaced with newid
. The method does
not descend into child elements.
renameUnitSIdRefs
 in class SBase
oldid
- the old identifiernewid
- the new identifierpublic int setCompartmentType(java.lang.String sid)
Compartment
.
sid
- the identifier of a CompartmentType
object defined elsewhere
in this Model
. If the string is null
, this method will return
LIBSBML_INVALID_ATTRIBUTE_VALUE
.
public int setConstant(boolean value)
Compartment
.
value
- a boolean indicating whether the size/volume of this
compartment should be considered constant (true
) or variable
(false
).
public int setId(java.lang.String sid)
Compartment
.
The string sid
is copied.
SBML has strict requirements for the syntax of identifiers, that is, the
values of the 'id' attribute present on most types of SBML objects.
The following is a summary of the definition of the SBML identifier type
SId
, which defines the permitted syntax of identifiers. We
express the syntax using an extended form of BNF notation:
letter .= 'a'..'z','A'..'Z' digit .= '0'..'9' idChar .= letter | digit | '_' SId .= ( letter | '_' ) idChar*The characters
(
and )
are used for grouping, the
character *
'zero or more times', and the character
|
indicates logical 'or'. The equality of SBML identifiers is
determined by an exact character sequence match i.e., comparisons must be
performed in a case-sensitive manner. In addition, there are a few
conditions for the uniqueness of identifiers in an SBML model. Please
consult the SBML specifications for the exact details of the uniqueness
requirements.
setId
 in class SBase
sid
- the string to use as the identifier of this Compartment
. If
the string is null
, this method will return
LIBSBML_INVALID_ATTRIBUTE_VALUE
.
public int setName(java.lang.String name)
Compartment
.
The string in name
is copied.
setName
 in class SBase
name
- the new name for the Compartment
. If the string is null
,
this method will return
LIBSBML_INVALID_ATTRIBUTE_VALUE
.
public int setOutside(java.lang.String sid)
Compartment
.
sid
- the identifier of a compartment that encloses this one. If
sid
is null
, then this method will return
LIBSBML_INVALID_ATTRIBUTE_VALUE
.
public int setSize(double value)
Compartment
.
value
- a double
representing the size of this compartment
instance in whatever units are in effect for the compartment.
Compartment.isSetSize()
,
Compartment.setVolume(double value)
Compartment.setVolume(double value)
.
public int setSpatialDimensions(double value)
Compartment
as a double.
value
- a double indicating the number of dimensions
of this compartment.
public int setSpatialDimensions(long value)
Compartment
.
value
- a long integereger indicating the number of dimensions
of this compartment.
public int setUnits(java.lang.String sid)
Compartment
.
sid
- the identifier of the defined units to use. If sid
is
null
, then this method will return
LIBSBML_INVALID_ATTRIBUTE_VALUE
.
public int setVolume(double value)
Compartment
.
This method is identical to
Compartment.setSize(double value)
and is provided for compatibility between SBML Level 1 and
higher Levels of SBML.
value
- a double
representing the volume of this compartment
instance in whatever units are in effect for the compartment.
Compartment.isSetVolume()
,
Compartment.setSize(double value)
1.0
) and therefore methods such as
Compartment.isSetVolume()
will always return true
for a Level 1 model. In Level 2, a
compartment's size (the equivalent of SBML Level 1's 'volume') is
optional and has no default value, and therefore may or may not be set.
public int unsetCompartmentType()
Compartment
.
Compartment.setCompartmentType(String sid)
,
Compartment.isSetCompartmentType()
public int unsetName()
Compartment
.
public int unsetOutside()
Compartment
.
public int unsetSize()
Compartment
.
In SBML Level 1, a compartment's volume has a default value (
1.0
) and therefore should always be set. Calling this method
on a Level 1 model resets the value to 1.0
rather than actually
unsetting it. In Level 2, a compartment's 'size' is optional with
no default value, and unsetting it will result in the compartment having
no defined size.
Compartment.unsetVolume()
.public int unsetSpatialDimensions()
Compartment
.
In SBML Levels prior to Level 3, compartments must always have a
value for the number of dimensions. Consequently, calling this method
on a model of SBML Level 1&ndash2 will result in a return value of
LIBSBML_UNEXPECTED_ATTRIBUTE
public int unsetUnits()
Compartment
.
public int unsetVolume()
Compartment
.
This method is identical to
Compartment.unsetSize()
. Please refer
to that method's documentation for more information about its behavior.
Compartment.unsetSize()
1.0
) and therefore methods such as
Compartment.isSetVolume()
will always return true
for a Level 1 model. In Level 2, a
compartment's size (the equivalent of SBML Level 1's 'volume') is
optional and has no default value, and therefore may or may not be set.