org.sbml.jsbml
public class Compartment extends Symbol
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
compartmentTypeID
Deprecated.
|
private static java.lang.String |
ERROR_MESSAGE_INVALID_DIM
This message will be displayed if the user tries to set the spatial
dimensions of this element to a value other than 0, 1, 2, or 3.
|
private static java.lang.String |
ERROR_MESSAGE_ZERO_DIM
This is the error message to be displayed if an application tries to set
units or size attribute for this compartment but the spatial dimensions
have been set to zero.
|
private boolean |
isSetSpatialDimensions
Helper variable to check if spatial dimensions has been set by the user.
|
private static org.apache.log4j.Logger |
logger
A
Logger for this class. |
private java.lang.String |
outsideID
Deprecated.
|
private static long |
serialVersionUID
Generated serial version identifier.
|
private java.lang.Double |
spatialDimensions
Represents the spatialDimensions XML attribute of a compartment element.
|
constant, isSetConstant
value
unitsID
ignoredExtensions, ignoredXMLElements, lv
listOfListeners, parent, UNKNOWN_ATTRIBUTES, UNKNOWN_ELEMENTS
Constructor and Description |
---|
Compartment()
Creates a Compartment instance.
|
Compartment(Compartment compartment)
Creates a Compartment instance from a given compartment.
|
Compartment(int level,
int version)
Creates a Compartment instance from a level and version.
|
Compartment(java.lang.String id)
Creates a Compartment instance with the given id.
|
Compartment(java.lang.String id,
int level,
int version)
Creates a Compartment instance from an id, level and version.
|
Compartment(java.lang.String id,
java.lang.String name,
int level,
int version)
Creates a Compartment instance from an id, name, level and version.
|
Modifier and Type | Method and Description |
---|---|
Compartment |
clone()
Creates a deep copy of this object, i.e., a new
SBase with the same properties
like this one. |
boolean |
containsUndeclaredUnits()
Returns
true or false depending on whether this
SBaseWithDerivedUnit refers to elements such as parameters or
numbers with undeclared units. |
boolean |
equals(java.lang.Object object)
|
java.lang.String |
getCompartmentType()
Deprecated.
Only defined in SBML Level 2 Versions 2 through 4.
|
CompartmentType |
getCompartmentTypeInstance()
Deprecated.
|
UnitDefinition |
getDerivedUnitDefinition()
Derives the unit of this quantity and tries to identify an
equivalent
UnitDefinition within the corresponding Model . |
java.lang.String |
getOutside()
Returns the outside id of this compartment.
|
Compartment |
getOutsideInstance()
Returns the compartment instance which matches the outside id in Model.
|
java.lang.String |
getPredefinedUnitID()
Returns the predefined unit identifier for this data type with the
current level/version combination.
|
double |
getSize()
Returns the size of this compartment.
|
double |
getSpatialDimensions()
Returns the
spatialDimensions of this Compartment . |
double |
getSpatialDimensionsAsDouble()
Deprecated.
|
java.lang.String |
getUnits() |
UnitDefinition |
getUnitsInstance() |
double |
getVolume()
Deprecated.
The volume attribute is only defined in SBML Level 1. Please
use
getSize() . |
int |
hashCode()
Returns a hash code value for this
SBase instance. |
void |
initDefaults()
Initializes the default values using the current Level/Version configuration.
|
void |
initDefaults(int level,
int version)
Initializes the default values using the current Level/Version configuration.
|
boolean |
isSetCompartmentType()
Returns
true if the compartmentID of this compartment is not null . |
boolean |
isSetCompartmentTypeInstance()
Deprecated.
|
boolean |
isSetOutside()
Returns
true if the outsideID of this compartment is not null . |
boolean |
isSetOutsideInstance()
Returns
true if the compartment instance which matches the outsideID of
this compartment is not null . |
boolean |
isSetSize()
Returns
true if the size of this compartment has been set by a user. |
boolean |
isSetSpatialDimensions()
Returns
true if the spatialDimensions of this compartment has been set by a user. |
boolean |
isSetVolume()
Deprecated.
The volume attribute is only defined in SBML Level 1. Please
use
isSetSize() |
boolean |
readAttribute(java.lang.String attributeName,
java.lang.String prefix,
java.lang.String value)
Sets the given attribute in this
SBase . |
void |
setCompartmentType(CompartmentType compartmentType)
Deprecated.
|
void |
setCompartmentType(java.lang.String compartmentTypeID)
Deprecated.
Only valid in Level 2.
|
void |
setOutside(Compartment outside)
Deprecated.
|
void |
setOutside(java.lang.String outside)
Deprecated.
since Level 3 Version 1
|
void |
setSize(double size)
Sets the size of this compartment to 'size'.
|
void |
setSpatialDimensions(double spatialDimension)
Sets the spatialDimensions of this compartment to 'i'.
|
void |
setSpatialDimensions(int spatialDimensions) |
void |
setSpatialDimensions(short spatialDimensions)
Sets the spatialDimensions of this compartment to 'spatialDimensiosn'.
|
void |
setUnits(java.lang.String units)
Sets the unitsID of this
QuantityWithUnit . |
void |
setUnits(Unit.Kind unitKind)
Sets the unit of this Compartment.
|
void |
setUnits(Unit unit)
Sets the
Unit of this Compartment . |
void |
setUnits(UnitDefinition unitDefinition)
Set the unit attribute of this Compartment to the given unit definition.
|
void |
setValue(double value)
Sets the value of this
Quantity . |
void |
setVolume(double value)
Deprecated.
This method is only available for SBML Level 1. You should
either use
setSize(double) or
setValue(double) . |
void |
unsetCompartmentType()
Sets the compartmentTypeID of this
Compartment to null . |
void |
unsetOutside()
Deprecated.
since Level 3 Version 1
|
void |
unsetSize()
Unsets the value of the 'size' attribute of this Compartment.
|
void |
unsetSpatialDimensions()
Sets the spatialDimensions of this compartment to
null . |
void |
unsetVolume()
Deprecated.
The volume attribute is only defined in SBML Level 1. Please
use
unsetSize() |
java.util.Map<java.lang.String,java.lang.String> |
writeXMLAttributes()
Returns a map with all the attributes of this
SBase that
need to be written out in XML. |
getConstant, isConstant, isSetConstant, setConstant, unsetConstant
getValue, isIdMandatory, isSetValue, unsetValue
getDerivedUnits, isPredefinedUnitsID, isSetUnits, isSetUnitsInstance, unsetUnits
checkIdentifier, getId, getName, isSetId, isSetName, isValidId, setId, setName, toString, unsetId, unsetName
addCVTerm, addDeclaredNamespace, addExtension, addPlugin, appendNotes, appendNotes, checkLevelAndVersionCompatibility, createHistory, createPlugin, disablePackage, enablePackage, enablePackage, filterCVTerms, filterCVTerms, filterCVTerms, filterCVTerms, fireNodeRemovedEvent, firePropertyChange, getAllowsChildren, getAnnotation, getAnnotationString, getChildAt, getChildCount, getCVTerm, getCVTermCount, getCVTerms, getDeclaredNamespaces, getElementName, getExtension, getExtensionCount, getExtensionPackages, getHistory, getIdManager, getLevel, getLevelAndVersion, getMetaId, getModel, getNamespace, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getParent, getParentSBMLObject, getPlugin, getSBMLDocument, getSBOTerm, getSBOTermID, getVersion, hasValidAnnotation, hasValidLevelVersionNamespaceCombination, isExtendedByOtherPackages, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetHistory, isSetLevel, isSetLevelAndVersion, isSetMetaId, isSetNotes, isSetParentSBMLObject, isSetPlugin, isSetSBOTerm, isSetVersion, isValidLevelAndVersionCombination, isValidMetaId, notifyChildChange, registerChild, removeCVTerm, removeCVTerm, setAnnotation, setHistory, setLevel, setLevelAndVersion, setMetaId, setNamespace, setNotes, setNotes, setParentSBML, setParentSBMLObject, setSBOTerm, setSBOTerm, setThisAsParentSBMLObject, setVersion, unregisterChild, unsetAnnotation, unsetCVTerms, unsetExtension, unsetHistory, unsetMetaId, unsetNamespace, unsetNotes, unsetPlugin, unsetSBOTerm
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getRoot, getTreeNodeChangeListenerCount, getUserObject, indexOf, isLeaf, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, setParent, userObjectKeySet
finalize, getClass, notify, notifyAll, wait, wait, wait
getValue, isSetValue, unsetValue
getId, getName, isIdMandatory, isSetId, isSetName, setId, setName, unsetId, unsetName
getDerivedUnits
addCVTerm, addDeclaredNamespace, addExtension, addPlugin, appendNotes, appendNotes, createPlugin, disablePackage, enablePackage, enablePackage, filterCVTerms, filterCVTerms, filterCVTerms, filterCVTerms, getAnnotation, getAnnotationString, getCVTerm, getCVTermCount, getCVTerms, getDeclaredNamespaces, getElementName, getExtension, getExtensionCount, getExtensionPackages, getHistory, getLevel, getLevelAndVersion, getMetaId, getModel, getNamespace, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getParentSBMLObject, getPlugin, getSBMLDocument, getSBOTerm, getSBOTermID, getVersion, hasValidAnnotation, hasValidLevelVersionNamespaceCombination, isExtendedByOtherPackages, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetHistory, isSetLevel, isSetLevelAndVersion, isSetMetaId, isSetNotes, isSetParentSBMLObject, isSetPlugin, isSetSBOTerm, isSetVersion, registerChild, removeCVTerm, removeCVTerm, removeTreeNodeChangeListener, setAnnotation, setHistory, setLevel, setMetaId, setNotes, setNotes, setSBOTerm, setSBOTerm, setThisAsParentSBMLObject, setVersion, unregisterChild, unsetAnnotation, unsetCVTerms, unsetExtension, unsetHistory, unsetMetaId, unsetNotes, unsetPlugin, unsetSBOTerm
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, fireNodeRemovedEvent, firePropertyChange, getListOfTreeNodeChangeListeners, getRoot, getTreeNodeChangeListenerCount, getUserObject, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeUserObject, userObjectKeySet
private static final java.lang.String ERROR_MESSAGE_INVALID_DIM
private static final java.lang.String ERROR_MESSAGE_ZERO_DIM
private static final transient org.apache.log4j.Logger logger
Logger
for this class.private static final long serialVersionUID
@Deprecated private java.lang.String compartmentTypeID
private boolean isSetSpatialDimensions
@Deprecated private java.lang.String outsideID
private java.lang.Double spatialDimensions
public Compartment()
null
.public Compartment(Compartment compartment)
compartment
- the compartment object to clone.public Compartment(int level, int version)
null
.level
- the SBML levelversion
- the SBML levelpublic Compartment(java.lang.String id)
id
- the compartment id.public Compartment(java.lang.String id, int level, int version)
null
.id
- the compartment id.level
- the SBML levelversion
- the SBML levelpublic Compartment(java.lang.String id, java.lang.String name, int level, int version)
null
.id
- the compartment id.name
- the compartment name.level
- the SBML levelversion
- the SBML levelpublic Compartment clone()
SBase
SBase
with the same properties
like this one.public boolean containsUndeclaredUnits()
SBaseWithDerivedUnit
true
or false
depending on whether this
SBaseWithDerivedUnit
refers to elements such as parameters or
numbers with undeclared units.
A return value of true indicates that the UnitDefinition
returned by SBaseWithDerivedUnit.getDerivedUnitDefinition()
may not accurately
represent the units of the expression.containsUndeclaredUnits
in interface SBaseWithDerivedUnit
containsUndeclaredUnits
in class AbstractNamedSBaseWithUnit
true
if the math expression of this SBaseWithDerivedUnit
includes parameters/numbers with undeclared units,
false
otherwise.public boolean equals(java.lang.Object object)
SBase
@Deprecated public java.lang.String getCompartmentType()
@Deprecated public CompartmentType getCompartmentTypeInstance()
public UnitDefinition getDerivedUnitDefinition()
SBaseWithDerivedUnit
UnitDefinition
within the corresponding Model
.
If no equivalent unit definition can be found, a new unit definition will
be created that is not part of the model but represents the unit of this
quantity. If it is not possible to derive a unit for this quantity, null
will be returned.getDerivedUnitDefinition
in interface SBaseWithDerivedUnit
getDerivedUnitDefinition
in class AbstractNamedSBaseWithUnit
UnitDefinition
that represent the derived unit of this quantity, or null
if it is not possible to derive a unit.public java.lang.String getOutside()
public Compartment getOutsideInstance()
public java.lang.String getPredefinedUnitID()
AbstractNamedSBaseWithUnit
getPredefinedUnitID
in class AbstractNamedSBaseWithUnit
Model
. This can
be one of the predefined unit identifiers if there are any.public double getSize()
public double getSpatialDimensions()
spatialDimensions
of this Compartment
. If it
is not set and the level of this Compartment
is either one or two
it returns the default SBML Level 2 value, which is 3. In all other
cases, Double.NaN
will be returned.spatialDimensions
of this Compartment
or 3
if spatialDimensions
is not set and level is 1 or 2.@Deprecated public double getSpatialDimensionsAsDouble()
getSpatialDimensions()
public java.lang.String getUnits()
getUnits
in interface SBaseWithUnit
getUnits
in class AbstractNamedSBaseWithUnit
SBaseWithUnit
. The empty
String
if it is not set.public UnitDefinition getUnitsInstance()
getUnitsInstance
in interface SBaseWithUnit
getUnitsInstance
in class AbstractNamedSBaseWithUnit
UnitDefinition
instance which has the unitsID
of
this SBaseWithUnit
as id. Null if it doesn't
exist. In case that the unit of this SBaseWithUnit
represents a base Unit
, a new UnitDefinition
will
be created and returned by this method. This new
UnitDefinition
will only contain the one unit represented
by the unit identifier in this SBaseWithUnit
. Note
that the corresponding model will not contain this
UnitDefinition
. The identifier of this new
UnitDefinition
will be set to the same value as the name
of the base Unit
.@Deprecated public double getVolume()
getSize()
.Compartment
public int hashCode()
SBase
SBase
instance.public void initDefaults()
public void initDefaults(int level, int version)
level
- version
- public boolean isSetCompartmentType()
true
if the compartmentID of this compartment is not null
.true
if the compartmentID of this compartment is not null
.@Deprecated public boolean isSetCompartmentTypeInstance()
true
if the compartmentType instance which matches the
compartmentTypeID of this compartment is not null
.true
if the compartmentType instance which matches the
compartmentTypeID of this compartment is not null
.public boolean isSetOutside()
true
if the outsideID of this compartment is not null
.true
if the outsideID of this compartment is not null
.public boolean isSetOutsideInstance()
true
if the compartment instance which matches the outsideID of
this compartment is not null
.true
if the compartment instance which matches the outsideID of
this compartment is not null
.public boolean isSetSize()
true
if the size of this compartment has been set by a user.true
if the size of this compartment has been set by a user.public boolean isSetSpatialDimensions()
true
if the spatialDimensions of this compartment has been set by a user.true
if the spatialDimensions of this compartment has been set by a user.@Deprecated public boolean isSetVolume()
isSetSize()
Returns true
or false depending on whether this Compartment's 'volume'
attribute has been set.
Some words of explanation about the set/unset/isSet methods: SBML Levels 1 and 2 define certain attributes on some classes of objects as optional. This requires an application to be careful about the distinction between two cases: (1) a given attribute has never been set to a value, and therefore should be assumed to have the SBML-defined default value, and (2) a given attribute has been set to a value, but the value happens to be an empty string. LibSBML supports these distinctions by providing methods to set, unset, and query the status of attributes that are optional. The methods have names of the form setAttribute(...), unsetAttribute(), and isSetAttribute(), where Attribute is the the name of the optional attribute in question.
This method is similar but not identical to isSetSize()
. The
latter should not be used in the context of SBML Level 1 models because
this method (isSetVolume()) 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 L2) of this Compartment
has been set, false
otherwise.isSetSize()
public boolean readAttribute(java.lang.String attributeName, java.lang.String prefix, java.lang.String value)
SBase
SBase
.
If the given attribute name is not recognized, nothing is done and
false
is returned.
readAttribute
in interface SBase
readAttribute
in class AbstractNamedSBase
attributeName
- localName of the XML attributeprefix
- prefix of the XML attributevalue
- value of the XML attributetrue
if the attribute has been successfully read.@Deprecated public void setCompartmentType(CompartmentType compartmentType)
compartmentType
- @Deprecated public void setCompartmentType(java.lang.String compartmentTypeID)
compartmentTypeID
- PropertyNotAvailableException
- if Level is not 2.@Deprecated public void setOutside(Compartment outside)
outside
- @Deprecated public void setOutside(java.lang.String outside)
outside
- PropertyNotAvailableException
- if Level greater than 2.public void setSize(double size)
size
- PropertyNotAvailableException
- in case of Level < 2.public void setSpatialDimensions(double spatialDimension)
spatialDimension
- java.lang.IllegalArgumentException
- if spatialDimension < 0 or if spatialDimension > 3PropertyNotAvailableException
- if Level < 2.public void setSpatialDimensions(int spatialDimensions)
spatialDimensions
- public void setSpatialDimensions(short spatialDimensions)
spatialDimensions
- java.lang.IllegalArgumentException
- if spatialDimension < 0 or if spatialDimension > 3public void setUnits(java.lang.String units)
QuantityWithUnit
. Only valid unit
kind names or identifiers of already existing UnitDefinition
s are
allowed arguments of this function.setUnits
in interface SBaseWithUnit
setUnits
in class AbstractNamedSBaseWithUnit
units
- the identifier of an already existing UnitDefinition
or an Unit.Kind
identifier for the current
level/version combination of this unit. Passing a null value
to this method is equivalent to calling AbstractNamedSBaseWithUnit.unsetUnits()
.java.lang.IllegalArgumentException
- if the unit is not valid or if spatialDimensions = 0.public void setUnits(Unit unit)
Unit
of this Compartment
.setUnits
in interface SBaseWithUnit
setUnits
in class AbstractNamedSBaseWithUnit
unit
- java.lang.IllegalArgumentException
- if spatialDimensions = 0.public void setUnits(Unit.Kind unitKind)
setUnits
in interface SBaseWithUnit
setUnits
in class AbstractNamedSBaseWithUnit
unitKind
- java.lang.IllegalArgumentException
- if spatialDimensions = 0.public void setUnits(UnitDefinition unitDefinition)
setUnits
in interface SBaseWithUnit
setUnits
in class AbstractNamedSBaseWithUnit
unitDefinition
- java.lang.IllegalArgumentException
- if spatialDimensions <= 0.public void setValue(double value)
Quantity
Quantity
.
Note that the meaning of the value can be different in all derived
classes. In Compartment
s the value defines its size. In
Species
the value describes either the initial amount or the
initial concentration. Only the class Parameter
and
LocalParameter
really define a value attribute with this name.setValue
in interface Quantity
setValue
in class QuantityWithUnit
value
- the value to set@Deprecated public void setVolume(double value)
setSize(double)
or
setValue(double)
.Sets the 'volume' attribute (or 'size' in SBML Level 2) of this Compartment.
Some words of explanation about the set/unset/isSet methods: SBML Levels 1 and 2 define certain attributes on some classes of objects as optional. This requires an application to be careful about the distinction between two cases: (1) a given attribute has never been set to a value, and therefore should be assumed to have the SBML-defined default value, and (2) a given attribute has been set to a value, but the value happens to be an empty string. LibSBML supports these distinctions by providing methods to set, unset, and query the status of attributes that are optional. The methods have names of the form setAttribute(...), unsetAttribute(), and isSetAttribute(), where Attribute is the the name of the optional attribute in question.
This method is identical to setSize(double)
and is provided for
compatibility between SBML Level 1 and Level 2.
value
- a double representing the volume of this compartment instance
in whatever units are in effect for the compartment.PropertyNotAvailableException
- if Level is not 1.public void unsetCompartmentType()
Compartment
to null
.@Deprecated public void unsetOutside()
null
.public void unsetSize()
Unsets the value of the 'size' attribute of this Compartment.
Some words of explanation about the set/unset/isSet methods: SBML Levels 1 and 2 define certain attributes on some classes of objects as optional. This requires an application to be careful about the distinction between two cases: (1) a given attribute has never been set to a value, and therefore should be assumed to have the SBML-defined default value, and (2) a given attribute has been set to a value, but the value happens to be an empty string. LibSBML supports these distinctions by providing methods to set, unset, and query the status of attributes that are optional. The methods have names of the form setAttribute(...), unsetAttribute(), and isSetAttribute(), where Attribute is the the name of the optional attribute in question.
public void unsetSpatialDimensions()
null
.@Deprecated public void unsetVolume()
unsetSize()
Unsets the value of the 'volume' attribute of this Compartment.
Some words of explanation about the set/unset/isSet methods: SBML Levels 1 and 2 define certain attributes on some classes of objects as optional. This requires an application to be careful about the distinction between two cases: (1) a given attribute has never been set to a value, and therefore should be assumed to have the SBML-defined default value, and (2) a given attribute has been set to a value, but the value happens to be an empty string. LibSBML supports these distinctions by providing methods to set, unset, and query the status of attributes that are optional. The methods have names of the form setAttribute(...), unsetAttribute(), and isSetAttribute(), where Attribute is the the name of the optional attribute in question.
In SBML Level 1, a Compartment volume has a default value (1.0) and therefore should always be set. In Level 2, 'size' is optional with no default value and as such may or may not be set.
public java.util.Map<java.lang.String,java.lang.String> writeXMLAttributes()
SBase
SBase
that
need to be written out in XML.
The attribute name is used as a key and the attribute value as value. If a prefix is needed for the attribute name, it need to be set directly in this map.
writeXMLAttributes
in interface SBase
writeXMLAttributes
in class AbstractNamedSBase
Map
containing the XML attributes of this object.