public class UnitDefinition extends SBase
Units of measurement may be supplied in a number of contexts in an SBML
model. The SBML unit definition facility uses two classes of objects,
UnitDefinition
and Unit
. The approach to defining units in SBML is
compositional for example, meter second &ndash2 is
constructed by combining a Unit
object representing meter with
another Unit
object representing second &ndash2.
The combination is wrapped inside a UnitDefinition
, which provides for
assigning an identifier and optional name to the combination. The
identifier can then be referenced from elsewhere in a model. Thus, the
UnitDefinition
class is the container, and Unit
instances are placed
inside UnitDefinition
instances.
Two points are worth discussing in the context of SBML units. First,
unit declarations in SBML models are optional. The consequence of
this is that a model must be numerically self-consistent independently
of unit declarations, for the benefit of software tools that cannot
interpret or manipulate units. Unit
declarations in SBML are thus more
akin to a type of annotation they can indicate intentions, and can be
used by model readers for checking the consistency of the model,
labeling simulation output, etc., but any transformations of values
implied by different units must be incorporated explicitly into a
model.
Second, the vast majority of situations that require new SBML unit definitions involve simple multiplicative combinations of base units and factors. An example is moles per litre per second. What distinguishes these sorts of unit definitions from more complex ones is that they may be expressed without the use of an additive offset from a zero point. The use of offsets complicates all unit definition systems, yet in the domain of SBML, the real-life cases requiring offsets are few (and in fact, to the best of our knowledge, only involve temperature). Consequently, the SBML unit system has been consciously designed to simplify implementation of unit support for the most common cases in systems biology. The cost of this simplification is to require units with offsets to be handled explicitly by the modeler.
UnitDefinition
construct
UnitDefinition
has two attributes and one subelement. The two
attributes are 'id' and 'name', and the subelement is ListOfUnits
.
The required attribute 'id' and optional attribute 'name' are both strings. The 'id' attribute is used to give the defined unit a unique identifier by which other parts of an SBML model definition can refer to it. The 'name' attribute is intended to be used for giving the unit definition an optional human-readable name. Please see the next section for information about the values permitted for 'id'.
A UnitDefinition
must contain exactly one ListOfUnits
, and this list
must contain one or more Unit
definitions see the definitions of these
other object classes for more information about them. The following
example illustrates a complete unit definition (when written in XML)
when they all the pieces are combined together. This defines 'mmls'
to be millimoles per litre per second.
<listOfUnitDefinitions> <unitDefinition id='mmls'> <listOfUnits> <unit kind='mole' scale='-3'/> <unit kind='litre' exponent='-1'/> <unit kind='second' exponent='-1'/> </listOfUnits> </unitDefinition> </listOfUnitDefinitions>
Unit
object identifiers
The attribute 'id' in UnitDefinition
cannot be given simply any value,
and the precise details of the values permitted differ slightly between
Levels of SBML:
UnitDefinition
must not contain a value from the
list of SBML's predefined base unit names (i.e., the strings gram
,
litre
, etc.). In SBML Level 3, this list consists of the
following:
ampere | farad | joule | lux | radian | volt |
avogadro | gram | katal | metre | second | watt |
becquerel | gray | kelvin | mole | siemens | weber |
candela | henry | kilogram | newton | sievert | |
coulomb | hertz | litre | ohm | steradian | |
dimensionless | item | lumen | pascal | tesla |
This list of predefined base units is nearly identical in SBML
Level 2 Version 4, the exception being that Level 2 does
not define avogadro.
SBML Level 2 Version 1 (and only
this Level+Version combination) provides an additional predefined unit
name, Celsius
, not available in Level 3. Finally, SBML
Level 1 Versions 2&ndash3 provide two more additional
predefined unit names, meter
and liter.
This is explained in
somewhat greater detail in the description of the Unit
class.
substance
, volume
, area
, length
, and
time.
Using one of these values for the attribute 'id' of a
UnitDefinition
has the effect of redefining the model-wide default units
for the corresponding quantities. The list of special unit names in
SBML Level 2 is given in the table below:
Identifier | Possible scalable units | Default units |
---|---|---|
substance | mole, item, gram, kilogram, dimensionless | mole |
volume | litre, cubic metre, dimensionless | litre |
area | square metre, dimensionless | square metre |
length | metre, dimensionless | metre |
time | second, dimensionless | second |
Also, SBML Level 2 imposes two limitations on redefining the
predefined unit substance
, volume
, area
, length
, and
time:
(1) The UnitDefinition
of a predefined SBML unit can only contain
a single Unit
object within it. (2) The value of the 'kind' attribute
in a Unit
instance must be drawn from one of the values in the second
column of the table above.
The special unit names substance
, volume
, area
, length
, and
time
are not defined by SBML Level 3, which uses a different
approach to setting model-wide inherited units.
The vast majority of modeling situations requiring new SBML unit definitions involve simple multiplicative combinations of base units and factors. An example of this might be moles per litre per second. What distinguishes these sorts of simpler unit definitions from more complex ones is that they may be expressed without the use of an additive offset from a zero point. The use of offsets complicates all unit definition systems, yet in the domain of SBML the real-life cases requiring offsets are few (and in fact, to the best of our knowledge, only involve temperature). Consequently, the SBML unit system has been consciously designed in a way that attempts to simplify implementation of unit support for the most common cases in systems biology.
As of SBML Level 2 Version 2, Unit
no longer has the
attribute called 'offset' introduced in SBML Level 2
Version 1. It turned out that the general case involving units
with offsets was incorrectly defined, and few (if any) developers even
attempted to support offset-based units in their software. In the
development of Level 2 Version 2, a consensus among SBML
developers emerged that a fully generalized unit scheme is so
confusing and complicated that it actually impedes interoperability.
SBML Level 2 Version 2, Version 3 and Version 4 acknowledge this
reality by reducing and simplifying the unit system, specifically by
removing the 'offset' attribute on Unit
and Celsius
as a pre-defined
unit.
The following guidelines suggest methods for handling units that do require the use of zero offsets for their definitions:
FunctionDefinition
object to define a function encapsulating this
relationship above and then using that in the rest of the model as
needed. Since Celsius is a commonly-used unit, software tools could
help users by providing users with the ability to express temperatures
in Celsius in the tools' interfaces, and making substitutions
automatically when writing out the SBML.
FunctionDefinition
to define a function
encapsulating the necessary mathematical relationship, then
substituting a call to this function wherever the original quantity
appeared in the model. For example, here is a possible definition for
converting Fahrenheit to Celsius degrees:
<functionDefinition id='Fahrenheit_to_kelvin'> <math xmlns='http://www.w3.org/1998/Math/MathML'> <lambda> <bvar><ci> temp_in_fahrenheit </ci></bvar> <apply> <divide/> <apply> <plus/> <ci> temp_in_fahrenheit </ci> <cn> 459.67 </cn> </apply> <cn> 1.8 </cn> </apply> </lambda> </math> </functionDefinition>
AssignmentRule
for each variable in Fahrenheit units.
The AssignmentRule
could compute the conversion from Fahrenheit to
(say) kelvin, assign its value to a variable (in Kelvin units), and
then that variable could be used elsewhere in the model.
Please consult the SBML specifications for more information about this and other issues involving units.
Constructor and Description |
---|
UnitDefinition(long level,
long version)
|
UnitDefinition(SBMLNamespaces sbmlns)
|
UnitDefinition(UnitDefinition orig)
Copy constructor creates a copy of this
UnitDefinition . |
Modifier and Type | Method and Description |
---|---|
int |
addUnit(Unit u)
Adds a copy of the given
Unit to this UnitDefinition . |
static boolean |
areEquivalent(UnitDefinition ud1,
UnitDefinition ud2)
Predicate returning
true if two
UnitDefinition objects are equivalent. |
static boolean |
areIdentical(UnitDefinition ud1,
UnitDefinition ud2)
Predicate returning
true if two
UnitDefinition objects are identical. |
UnitDefinition |
cloneObject()
Creates and returns a deep copy of this
UnitDefinition . |
static UnitDefinition |
combine(UnitDefinition ud1,
UnitDefinition ud2)
Combines two
UnitDefinition objects into a single UnitDefinition . |
static UnitDefinition |
convertToSI(UnitDefinition ud)
Convert a given
UnitDefinition into a new UnitDefinition object
that uses SI units. |
Unit |
createUnit()
Creates a new and empty
Unit , adds it to this UnitDefinition 's list of
units, and returns it. |
void |
delete()
Explicitly deletes the underlying native object.
|
static UnitDefinition |
divide(UnitDefinition ud1,
UnitDefinition ud2)
Combines two
UnitDefinition objects into a single UnitDefinition as
a division. |
SBase |
getElementByMetaId(java.lang.String metaid)
Returns the first child element it can find with the given
metaid , or
null if no such object is found. |
SBase |
getElementBySId(java.lang.String id)
Returns the first child element found that has the given
id in the
model-wide SId namespace, or null if no such object is found. |
java.lang.String |
getElementName()
Returns the XML element name of this object, which for
UnitDefinition ,
is always 'unitDefinition'. |
java.lang.String |
getId()
Returns the value of the 'id' attribute of this
UnitDefinition . |
ListOfUnits |
getListOfUnits()
Returns the list of Units for this
UnitDefinition instance. |
java.lang.String |
getName()
Returns the value of the 'name' attribute of this
UnitDefinition . |
long |
getNumUnits()
Returns the number of
Unit objects contained within this
UnitDefinition . |
int |
getTypeCode()
Returns the libSBML type code for this object instance.
|
Unit |
getUnit(long n)
Returns a specific
Unit instance belonging to this UnitDefinition . |
boolean |
hasRequiredAttributes()
Predicate returning
true if
all the required attributes for this UnitDefinition object
have been set. |
boolean |
hasRequiredElements()
Predicate returning
true if
all the required elements for this UnitDefinition object
have been set. |
boolean |
isSetId()
Predicate returning
true if this
UnitDefinition 's 'id' attribute is set. |
boolean |
isSetName()
Predicate returning
true if this
UnitDefinition 's 'name' attribute is set. |
boolean |
isVariantOfArea()
Convenience function for testing if a given unit definition is a
variant of the predefined unit identifier
'area'. |
boolean |
isVariantOfDimensionless()
Convenience function for testing if a given unit definition is a
variant of the unit
'dimensionless'. |
boolean |
isVariantOfLength()
Convenience function for testing if a given unit definition is a
variant of the predefined unit identifier
'length'. |
boolean |
isVariantOfMass()
Convenience function for testing if a given unit definition is a
variant of the predefined unit identifier
'mass'. |
boolean |
isVariantOfSubstance()
Convenience function for testing if a given unit definition is a
variant of the predefined unit identifier
'substance'. |
boolean |
isVariantOfSubstancePerTime()
Convenience function for testing if a given unit definition is a
variant of the predefined unit
'substance' divided by the predefined
unit 'time'. |
boolean |
isVariantOfTime()
Convenience function for testing if a given unit definition is a
variant of the predefined unit identifier
'time'. |
boolean |
isVariantOfVolume()
Convenience function for testing if a given unit definition is a
variant of the predefined unit identifier
'volume'. |
static java.lang.String |
printUnits(UnitDefinition ud)
Expresses the given definition in a plain-text form.
|
static java.lang.String |
printUnits(UnitDefinition ud,
boolean compact)
Expresses the given definition in a plain-text form.
|
Unit |
removeUnit(long n)
Removes the nth
Unit object from this UnitDefinition object and
returns a pointer to it. |
static void |
reorder(UnitDefinition ud)
|
int |
setId(java.lang.String sid)
Sets the value of the 'id' attribute of this
UnitDefinition . |
int |
setName(java.lang.String name)
Sets the value of the 'name' attribute of this
UnitDefinition . |
static void |
simplify(UnitDefinition ud)
Simplifies the
UnitDefinition such that any given kind of Unit object
occurs only once in the ListOfUnits . |
int |
unsetName()
Unsets the value of the 'name' attribute of this
UnitDefinition . |
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, 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, renameSIdRefs, renameUnitSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetId, unsetMetaId, unsetModelHistory, unsetNotes, unsetSBOTerm
public UnitDefinition(long level, long version) throws SBMLConstructorException
level
- a long integer, the SBML Level to assign to this UnitDefinition
version
- a long integer, the SBML Version to assign to this
UnitDefinition
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.
UnitDefinition
object to an SBMLDocument
(e.g., using Model.addUnitDefinition(UnitDefinition ud)
), the SBML Level, SBML Version
and XML namespace of the document override the values used
when creating the UnitDefinition
object via this constructor. This is
necessary to ensure that an SBML document is a consistent structure.
Nevertheless, the ability to supply the values at the time of creation
of a UnitDefinition
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 UnitDefinition(SBMLNamespaces sbmlns) throws SBMLConstructorException
UnitDefinition
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.
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.
UnitDefinition
object to an SBMLDocument
(e.g., using Model.addUnitDefinition(UnitDefinition ud)
), the SBML Level, SBML Version
and XML namespace of the document override the values used
when creating the UnitDefinition
object via this constructor. This is
necessary to ensure that an SBML document is a consistent structure.
Nevertheless, the ability to supply the values at the time of creation
of a UnitDefinition
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 UnitDefinition(UnitDefinition orig) throws SBMLConstructorException
UnitDefinition
.
orig
- the object to copy.
SBMLConstructorException
- Thrown if the argument orig
is null.
public int addUnit(Unit u)
Unit
to this UnitDefinition
.
u
- the Unit
instance to add to this UnitDefinition
.
LIBSBML_OPERATION_SUCCESS
LIBSBML_LEVEL_MISMATCH
LIBSBML_VERSION_MISMATCH
LIBSBML_INVALID_OBJECT
LIBSBML_OPERATION_FAILED
UnitDefinition.createUnit()
create
)
for alternatives that do not lead to these issues.
public static boolean areEquivalent(UnitDefinition ud1, UnitDefinition ud2)
true
if two
UnitDefinition
objects are equivalent.
For the purposes of performing this comparison, two UnitDefinition
objects are considered equivalent when they contain equivalent
list of Unit
objects. Unit
objects are in turn considered equivalent
if they satisfy the predicate
Unit.areEquivalent(Unit u1, Unit u2)
.
The predicate tests a subset of the objects's attributes.
ud1
- the first UnitDefinition
object to compare
ud2
- the second UnitDefinition
object to compare
true
if all the Unit
objects in ud1 are equivalent
to the Unit
objects in ud2, false
otherwise.
UnitDefinition.areIdentical(UnitDefinition ud1, UnitDefinition ud2)
,
Unit.areEquivalent(Unit unit1, Unit unit2)
public static boolean areIdentical(UnitDefinition ud1, UnitDefinition ud2)
true
if two
UnitDefinition
objects are identical.
For the purposes of performing this comparison, two UnitDefinition
objects are considered identical when they contain identical lists of
Unit
objects. Pairs of Unit
objects in the lists are in turn
considered identical if they satisfy the predicate
Unit.areIdentical(Unit u1, Unit u2)
.
The predicate compares every attribute of the
Unit
objects.
ud1
- the first UnitDefinition
object to compareud2
- the second UnitDefinition
object to compare
true
if all the Unit
objects in ud1 are identical to the
Unit
objects of ud2, false
otherwise.
UnitDefinition.areEquivalent(UnitDefinition ud1, UnitDefinition ud2)
,
Unit.areIdentical(Unit unit1, Unit unit2)
public UnitDefinition cloneObject()
UnitDefinition
.
cloneObject
 in class SBase
UnitDefinition
.public static UnitDefinition combine(UnitDefinition ud1, UnitDefinition ud2)
UnitDefinition
objects into a single UnitDefinition
.
This takes UnitDefinition
objects ud1
and ud2
, and creates a
UnitDefinition
object that expresses the product of the units of
ud1
and ud2
.
ud1
- the first UnitDefinition
objectud2
- the second UnitDefinition
object
UnitDefinition
which represents the product of the
units of the two argument UnitDefinitions.
public static UnitDefinition convertToSI(UnitDefinition ud)
UnitDefinition
into a new UnitDefinition
object
that uses SI units.
ud
- the UnitDefinition
object to convert to SI
UnitDefinition
object representing the results of the
conversion.
public Unit createUnit()
Unit
, adds it to this UnitDefinition
's list of
units, and returns it.
Unit
instance.
UnitDefinition.addUnit(Unit u)
Unit
is a required attribute for a valid Unit
definition. The
createUnit() method does not assign a valid kind to the constructed
unit (instead, it sets the 'kind' to UNIT_KIND_INVALID
).
Callers are cautioned to set the newly-constructed Unit
's kind using
Unit.setKind(int kind)
soon after calling this method.
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 UnitDefinition.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 UnitDefinition.delete()
themselves.
public static UnitDefinition divide(UnitDefinition ud1, UnitDefinition ud2)
UnitDefinition
objects into a single UnitDefinition
as
a division.
This takes UnitDefinition
objects ud1
and ud2
, and creates a
UnitDefinition
object that expresses the division of the units of
ud1
and ud2
.
ud1
- the first UnitDefinition
objectud2
- the second UnitDefinition
object
UnitDefinition
which represents the division of the
units of the two argument UnitDefinitions.
public SBase getElementByMetaId(java.lang.String metaid)
metaid
, or
null
if no such object is found.
getElementByMetaId
 in class SBase
metaid
- string representing the metaid of objects to find
metaid
.public SBase getElementBySId(java.lang.String id)
id
in the
model-wide SId namespace, or null
if no such object is found.
getElementBySId
 in class SBase
id
- string representing the id of objects to find.
id
.public java.lang.String getElementName()
UnitDefinition
,
is always 'unitDefinition'.
getElementName
 in class SBase
'unitDefinition'.
public java.lang.String getId()
UnitDefinition
.
getId
 in class SBase
UnitDefinition
.public ListOfUnits getListOfUnits()
UnitDefinition
instance.ListOfUnits
value for this UnitDefinition
.public java.lang.String getName()
UnitDefinition
.
getName
 in class SBase
UnitDefinition
.public long getNumUnits()
Unit
objects contained within this
UnitDefinition
.
UnitDefinition
.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_UNIT_DEFINITION
(default).
SBase.getPackageName()
,
UnitDefinition.getElementName()
public Unit getUnit(long n)
Unit
instance belonging to this UnitDefinition
.
n
- an integer, the index of the Unit
to be returned.
Unit
of this UnitDefinition
.
UnitDefinition.getNumUnits()
public boolean hasRequiredAttributes()
true
if
all the required attributes for this UnitDefinition
object
have been set.
hasRequiredAttributes
 in class SBase
UnitDefinition
object are:
public boolean hasRequiredElements()
true
if
all the required elements for this UnitDefinition
object
have been set.
hasRequiredElements
 in class SBase
Constraint
object are:
public boolean isSetId()
true
if this
UnitDefinition
's 'id' attribute is set.
isSetId
 in class SBase
true
if the 'id' attribute of this UnitDefinition
is
set, false
otherwise.public boolean isSetName()
true
if this
UnitDefinition
's 'name' attribute is set.
isSetName
 in class SBase
true
if the 'name' attribute of this UnitDefinition
is
set, false
otherwise.public boolean isVariantOfArea()
'area'.
true
if this UnitDefinition
is a variant of the predefined
unit area
, meaning square metres with only abritrary variations
in scale or multiplier values false
otherwise.public boolean isVariantOfDimensionless()
'dimensionless'.
true
if this UnitDefinition
is a variant of
dimensionless
, meaning dimensionless with only abritrary variations in
scale or multiplier values false
otherwise.public boolean isVariantOfLength()
'length'.
true
if this UnitDefinition
is a variant of the predefined
unit length
, meaning metres with only abritrary variations in scale
or multiplier values false
otherwise.public boolean isVariantOfMass()
'mass'.
true
if this UnitDefinition
is a variant of mass units,
meaning gram or kilogram with only abritrary variations in scale or
multiplier values false
otherwise.public boolean isVariantOfSubstance()
'substance'.
true
if this UnitDefinition
is a variant of the predefined
unit substance
, meaning moles or items (and grams or kilograms from
SBML Level 2 Version 2 onwards) with only abritrary variations
in scale or multiplier values false
otherwise.public boolean isVariantOfSubstancePerTime()
'substance'
divided by the predefined
unit 'time'.
true
if this UnitDefinition
is a variant of the predefined
unit substance
per predefined unit time
, meaning it contains two
units one of which is a variant of substance and the other is a
variant of time which an exponent of -1 false
otherwise.public boolean isVariantOfTime()
'time'.
true
if this UnitDefinition
is a variant of the predefined
unit time
, meaning seconds with only abritrary variations in scale or
multiplier values false
otherwise.public boolean isVariantOfVolume()
'volume'.
true
if this UnitDefinition
is a variant of the predefined
unit volume
, meaning litre or cubic metre with only abritrary
variations in scale or multiplier values false
otherwise.public static java.lang.String printUnits(UnitDefinition ud)
For example,
UnitDefinition.printUnits(UnitDefinition u)
applied to
<unitDefinition> <listOfUnits> <unit kind='metre' exponent='1'/> <unit kind='second' exponent='-2'/> </listOfUnits> <unitDefinition>
'metre (exponent = 1, multiplier = 1,
scale = 0) second (exponent = -2, multiplier = 1, scale = 0)'
or, if the optional parameter compact
is given the value true
,
the string '(1 metre)^1 (1 second)^-2'
. This method may
be useful for printing unit information to human users, or in
debugging software, or other situations.
ud
- the UnitDefinition
objectcompact
- boolean indicating whether the compact form
should be used (defaults to false)
UnitDefinition
object ud
.
public static java.lang.String printUnits(UnitDefinition ud, boolean compact)
For example,
UnitDefinition.printUnits(UnitDefinition u)
applied to
<unitDefinition> <listOfUnits> <unit kind='metre' exponent='1'/> <unit kind='second' exponent='-2'/> </listOfUnits> <unitDefinition>
'metre (exponent = 1, multiplier = 1,
scale = 0) second (exponent = -2, multiplier = 1, scale = 0)'
or, if the optional parameter compact
is given the value true
,
the string '(1 metre)^1 (1 second)^-2'
. This method may
be useful for printing unit information to human users, or in
debugging software, or other situations.
ud
- the UnitDefinition
objectcompact
- boolean indicating whether the compact form
should be used (defaults to false)
UnitDefinition
object ud
.
public Unit removeUnit(long n)
Unit
object from this UnitDefinition
object and
returns a pointer to it.
The caller owns the returned object and is responsible for deleting it.
public static void reorder(UnitDefinition ud)
ud
- the UnitDefinition
object whose units are to be reordered.
public int setId(java.lang.String sid)
UnitDefinition
.
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 UnitDefinition
public int setName(java.lang.String name)
UnitDefinition
.
The string in name
is copied.
setName
 in class SBase
name
- the new name for the UnitDefinition
public static void simplify(UnitDefinition ud)
UnitDefinition
such that any given kind of Unit
object
occurs only once in the ListOfUnits
.
For example, the following definition,
<unitDefinition> <listOfUnits> <unit kind='metre' exponent='1'/> <unit kind='metre' exponent='2'/> </listOfUnits> <unitDefinition>
<unitDefinition> <listOfUnits> <unit kind='metre' exponent='3'/> </listOfUnits> <unitDefinition>
ud
- the UnitDefinition
object to be simplified.
public int unsetName()
UnitDefinition
.