public class Parameter extends SBase
A Parameter
is used in SBML to define a symbol associated with a value
this symbol can then be used in mathematical formulas in a model. By
default, parameters have constant value for the duration of a
simulation, and for this reason are called parameters instead of
variables in SBML, although it is crucial to understand that SBML
parameters represent both concepts. Whether a given SBML
parameter is intended to be constant or variable is indicated by the
value of its 'constant' attribute.
SBML's Parameter
has a required attribute, 'id', that gives the
parameter a unique identifier by which other parts of an SBML model
definition can refer to it. A parameter 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.
The optional attribute 'value' determines the value (of type double
)
assigned to the parameter. A missing value for 'value' implies that
the value either is unknown, or to be obtained from an external source,
or determined by an initial assignment. The unit of measurement
associated with the value of the parameter can be specified using the
optional attribute 'units'. Here we only mention briefly some notable
points about the possible unit choices, but readers are urged to consult
the SBML specification documents for more information:
Model
object (unlike the case for, e.g.,
Species
and Compartment
).
'substance'
, 'time'
, 'volume'
, 'area'
or
'length'
or the identifier of a new unit defined in the list of unit
definitions in the enclosing Model
structure. There are no constraints
on the units that can be chosen from these sets. There are no default
units for parameters.
The Parameter
structure has another boolean attribute named 'constant'
that is used to indicate whether the parameter's value can vary during a
simulation. (In SBML Level 3, the attribute is mandatory and must
be given a value in SBML Levels below Level 3, the attribute is
optional.) A value of true
indicates the parameter's value cannot be
changed by any construct except InitialAssignment
. Conversely, if the
value of 'constant' is false
, other constructs in SBML, such as rules
and events, can change the value of the parameter.
SBML Level 3 uses a separate object class, LocalParameter
, for
parameters that are local to a Reaction
's KineticLaw
. In Levels prior
to SBML Level 3, the Parameter
class is used both for definitions
of global parameters, as well as reaction-local parameters stored in a
list within KineticLaw
objects. Parameter
objects that are local to a
reaction (that is, those defined within the KineticLaw
structure of a
Reaction
) cannot be changed by rules and therefore are implicitly
always constant consequently, in SBML Level 2, parameter
definitions within Reaction
structures should not have their
'constant' attribute set to false.
What if a global parameter has its 'constant' attribute set to false
,
but the model does not contain any rules, events or other constructs
that ever change its value over time? Although the model may be
suspect, this situation is not strictly an error. A value of false
for 'constant' only indicates that a parameter can change value, not
that it must.
As with all other major SBML components, Parameter
is derived from
SBase
, and the methods defined on SBase
are available on Parameter
.
Parameter
construct with the boolean flag
'constant' indicating which flavor it is. In any case, readers are
implored to look past their particular definition of a parameter and
simply view SBML's Parameter
as a single mechanism for defining both
constants and (additional) variables in a model. (We write
additional because the species in a model are usually considered to be
the central variables.) After all, software tools are not required to
expose to users the actual names of particular SBML constructs, and
thus tools can present to their users whatever terms their designers
feel best matches their target audience.
Constructor and Description |
---|
Parameter(long level,
long version)
|
Parameter(Parameter orig)
Copy constructor creates a copy of a
Parameter . |
Parameter(SBMLNamespaces sbmlns)
|
Modifier and Type | Method and Description |
---|---|
Parameter |
cloneObject()
Creates and returns a deep copy of this
Parameter . |
void |
delete()
Explicitly deletes the underlying native object.
|
boolean |
getConstant()
Gets the value of the 'constant' attribute of this
Parameter instance. |
UnitDefinition |
getDerivedUnitDefinition()
Constructs and returns a
UnitDefinition that corresponds to the units
of this Parameter 's value. |
String |
getElementName()
Returns the XML element name of this object, which for
Parameter , is
always 'parameter'. |
String |
getId()
Returns the value of the 'id' attribute of this
Parameter . |
String |
getName()
Returns the value of the 'name' attribute of this
Parameter . |
int |
getTypeCode()
Returns the libSBML type code for this SBML object.
|
String |
getUnits()
Gets the units defined for this
Parameter . |
double |
getValue()
Gets the numerical value of this
Parameter . |
boolean |
hasRequiredAttributes()
Predicate returning
true if
all the required attributes for this Parameter object
have been set. |
void |
initDefaults()
Initializes the fields of this
Parameter object to 'typical' defaults
values. |
boolean |
isSetConstant()
Predicate returning
true if the
'constant' attribute of this Parameter is set. |
boolean |
isSetId()
Predicate returning
true if this
Parameter 's 'id' attribute is set. |
boolean |
isSetName()
Predicate returning
true if this
Parameter 's 'name' attribute is set. |
boolean |
isSetUnits()
Predicate returning
true if the
'units' attribute of this Parameter is set. |
boolean |
isSetValue()
Predicate returning
true if the
'value' attribute of this Parameter is set. |
void |
renameUnitSIdRefs(String oldid,
String newid)
Renames all the UnitSIdRef attributes on this element
|
int |
setConstant(boolean flag)
Sets the 'constant' attribute of this
Parameter to the given boolean
flag . |
int |
setId(String sid)
Sets the value of the 'id' attribute of this
Parameter . |
int |
setName(String name)
Sets the value of the 'name' attribute of this
Parameter . |
int |
setUnits(String units)
Sets the 'units' attribute of this
Parameter to a copy of the given
units identifier units . |
int |
setValue(double value)
Sets the 'value' attribute of this
Parameter to the given double
value and marks the attribute as set. |
int |
unsetName()
Unsets the value of the 'name' attribute of this
Parameter . |
int |
unsetUnits()
Unsets the 'units' attribute of this
Parameter instance. |
int |
unsetValue()
Unsets the 'value' attribute of this
Parameter instance. |
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getElementByMetaId, getElementBySId, getLevel, getLine, getListOfAllElements, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, unsetAnnotation, unsetCVTerms, unsetId, unsetMetaId, unsetModelHistory, unsetNotes, unsetSBOTerm
public Parameter(long level, long version) throws SBMLConstructorException
level
- a long integer, the SBML Level to assign to this Parameter
version
- a long integer, the SBML Version to assign to this
Parameter
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.
Parameter
object to an SBMLDocument
(e.g., using Model.addParameter(Parameter p)
), the SBML Level, SBML Version
and XML namespace of the document override the values used
when creating the Parameter
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 Parameter
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 Parameter(Parameter orig) throws SBMLConstructorException
Parameter
.
orig
- the Parameter
instance to copy.
SBMLConstructorException
- Thrown if the argument orig
is null.
public Parameter(SBMLNamespaces sbmlns) throws SBMLConstructorException
Parameter
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 this class constructor is to create an
SBMLNamespaces
object somewhere in a program, once, then pass it to
object constructors such as this one when needed.
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 Parameter
is required to have a value.
Thus, callers are cautioned to assign a value after calling this
constructor if no identifier is provided as an argument. Setting the
identifier can be accomplished using the method
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.
Parameter
object to an SBMLDocument
(e.g., using Model.addParameter(Parameter p)
), the SBML XML namespace of the
document overrides the value used when creating the Parameter
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 Parameter
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 Parameter cloneObject()
Parameter
.
cloneObject
 in class SBase
Parameter
.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 Parameter.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 Parameter.delete()
themselves.
public boolean getConstant()
Parameter
instance.
true
if this Parameter
is declared as being constant,
false
otherwise.
Parameter.isSetConstant()
,
Parameter.setConstant(boolean flag)
LocalParameter
may be
confused about the presence of this method. LibSBML derives
LocalParameter
from Parameter
however, this does not precisely match
the object hierarchy defined by SBML Level 3, where
LocalParameter
is derived directly from SBase
and not Parameter
. We
believe this arrangement makes it easier for libSBML users to program
applications that work with both SBML Level 2 and SBML
Level 3, but programmers should also keep in mind this difference
exists. A side-effect of libSBML's scheme is that certain methods on
LocalParameter
that are inherited from Parameter
do not actually have
relevance to LocalParameter
objects. An example of this is the
methods pertaining to Parameter
's attribute 'constant' (i.e.,
isSetConstant(), setConstant(), and getConstant()).
public UnitDefinition getDerivedUnitDefinition()
UnitDefinition
that corresponds to the units
of this Parameter
's value.
Parameters in SBML have an attribute ('units') for declaring the units
of measurement intended for the parameter's value. No defaults are
defined by SBML in the absence of a definition for 'units'. This
method returns a UnitDefinition
object based on the units declared for
this Parameter
using its 'units' attribute, or it returns null
if
no units have been declared.
Note that unit declarations for Parameter
objects are specified in
terms of the identifier of a unit (e.g., using setUnits()), but
this method returns a UnitDefinition
object, not a unit
identifier. It does this by constructing an appropriate
UnitDefinition
.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.
UnitDefinition
that expresses the units of this
Parameter
, or null
if one cannot be constructed.
Parameter.isSetUnits()
Parameter
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 String getElementName()
Parameter
, is
always 'parameter'.
getElementName
 in class SBase
'parameter'.
public String getId()
Parameter
.
getId
 in class SBase
Parameter
.SBase.isSetMetaId()
,
SBase.setMetaId(String metaid)
public String getName()
Parameter
.
getName
 in class SBase
Parameter
.SBase.isSetMetaId()
,
SBase.setMetaId(String metaid)
public int getTypeCode()
LibSBML attaches an identifying code to every
kind of SBML object. These are known as SBML type codes. In
other languages, the set of type codes is stored in an enumeration in
the Java language interface for libSBML, the type codes are defined as
static integer constants in the interface class libsbmlConstants
. The names of the type codes all begin with the
characters SBML_.
getTypeCode
 in class SBase
SBML_UNKNOWN
(default).
Parameter.getElementName()
public String getUnits()
Parameter
.
The value of an SBML parameter's 'units' attribute establishes the unit of measurement associated with the parameter's value.
Parameter
, as a
string. An empty string indicates that no units have been assigned.
Parameter.isSetUnits()
,
Parameter.setUnits(String units)
,
Parameter.getValue()
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 getValue()
Parameter
.
Parameter
, as a
number of type double.
Parameter.isSetValue()
,
Parameter.setValue(double value)
,
Parameter.getUnits()
Parameter.getValue()
without first using Parameter.isSetValue()
to
determine whether a value has ever been set. Otherwise, the value
return by Parameter.getValue()
may not actually represent a value
assigned to the parameter. The reason is simply that the data type
double
in a program always has some value. A separate test is
needed to determine whether the value is a true model value, or
uninitialized data in a computer's memory location.
public boolean hasRequiredAttributes()
true
if
all the required attributes for this Parameter
object
have been set.
hasRequiredAttributes
 in class SBase
Parameter
object are:
public void initDefaults()
Parameter
object to 'typical' defaults
values.
The SBML Parameter
component has slightly different aspects and
default attribute values in different SBML Levels and Versions. Many
SBML object classes defined by libSBML have an initDefaults() method
to set the values to certain common defaults, based mostly on what
they are in SBML Level 2. In the case of Parameter
, this method
only sets the value of the 'constant' attribute to true.
public boolean isSetConstant()
true
if the
'constant' attribute of this Parameter
is set.
true
if the 'constant' attribute of this Parameter
is
set, false
otherwise.
Parameter.getConstant()
,
Parameter.setConstant(boolean flag)
LocalParameter
may be
confused about the presence of this method. LibSBML derives
LocalParameter
from Parameter
however, this does not precisely match
the object hierarchy defined by SBML Level 3, where
LocalParameter
is derived directly from SBase
and not Parameter
. We
believe this arrangement makes it easier for libSBML users to program
applications that work with both SBML Level 2 and SBML
Level 3, but programmers should also keep in mind this difference
exists. A side-effect of libSBML's scheme is that certain methods on
LocalParameter
that are inherited from Parameter
do not actually have
relevance to LocalParameter
objects. An example of this is the
methods pertaining to Parameter
's attribute 'constant' (i.e.,
isSetConstant(), setConstant(), and getConstant()).
public boolean isSetId()
true
if this
Parameter
's 'id' attribute is set.
isSetId
 in class SBase
true
if the 'id' attribute of this Parameter
is
set, false
otherwise.SBase.getMetaId()
,
SBase.setMetaId(String metaid)
public boolean isSetName()
true
if this
Parameter
's 'name' attribute is set.
isSetName
 in class SBase
true
if the 'name' attribute of this Parameter
is
set, false
otherwise.SBase.getMetaId()
,
SBase.setMetaId(String metaid)
public boolean isSetUnits()
true
if the
'units' attribute of this Parameter
is set.
true
if the 'units' attribute of this Parameter
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 isSetValue()
true
if the
'value' attribute of this Parameter
is set.
In SBML definitions after SBML Level 1 Version 1,
parameter values are optional and have no defaults. If a model read
from a file does not contain a setting for the 'value' attribute of a
parameter, its value is considered unset it does not default to any
particular value. Similarly, when a Parameter
object is created in
libSBML, it has no value until given a value. The
Parameter.isSetValue()
method allows calling applications to
determine whether a given parameter's value has ever been set.
In SBML Level 1 Version 1, parameters are required to have
values and therefore, the value of a Parameter
should always be
set. In Level 1 Version 2 and beyond, the value is
optional and as such, the 'value' attribute may or may not be set.
true
if the value of this Parameter
is set,
false
otherwise.
Parameter.getValue()
,
Parameter.setValue(double value)
public void renameUnitSIdRefs(String oldid, String newid)
renameUnitSIdRefs
 in class SBase
oldid
- the old identifiernewid
- the new identifierpublic int setConstant(boolean flag)
Parameter
to the given boolean
flag
.
flag
- a boolean, the value for the 'constant' attribute of this
Parameter
instance
Parameter.getConstant()
,
Parameter.isSetConstant()
LocalParameter
may be
confused about the presence of this method. LibSBML derives
LocalParameter
from Parameter
however, this does not precisely match
the object hierarchy defined by SBML Level 3, where
LocalParameter
is derived directly from SBase
and not Parameter
. We
believe this arrangement makes it easier for libSBML users to program
applications that work with both SBML Level 2 and SBML
Level 3, but programmers should also keep in mind this difference
exists. A side-effect of libSBML's scheme is that certain methods on
LocalParameter
that are inherited from Parameter
do not actually have
relevance to LocalParameter
objects. An example of this is the
methods pertaining to Parameter
's attribute 'constant' (i.e.,
isSetConstant(), setConstant(), and getConstant()).
public int setId(String sid)
Parameter
.
The string sid
is copied. Note that SBML has strict requirements
for the syntax of identifiers. 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 formulations.
public int setName(String name)
Parameter
.
The string in name
is copied.
public int setUnits(String units)
Parameter
to a copy of the given
units identifier units
.
units
- a string, the identifier of the units to assign to this
Parameter
instance
public int setValue(double value)
Parameter
to the given double
value and marks the attribute as set.
value
- a double
, the value to assign
public int unsetName()
Parameter
.
public int unsetUnits()
Parameter
instance.
public int unsetValue()
Parameter
instance.
In SBML Level 1 Version 1, parameters are required to have
values and therefore, the value of a Parameter
should always be
set. In SBML Level 1 Version 2 and beyond, the value
is optional and as such, the 'value' attribute may or may not be set.