public class FunctionDefinition extends SBase
The FunctionDefinition structure associates an identifier with a
function definition. This identifier can then be used as the function
called in subsequent MathML content elsewhere in an SBML model.
FunctionDefinition has one required attribute, 'id', to give the
function a unique identifier by which other parts of an SBML model
definition can refer to it. A FunctionDefinition instance can also have
an optional 'name' attribute of type string. Identifiers and names
must be used according to the guidelines described in the SBML
specification (e.g., Section 3.3 in the Level 2 Version 4
specification).
FunctionDefinition has a required 'math' subelement containing a MathML
expression defining the function body. The content of this element can
only be a MathML 'lambda' element. The 'lambda' element must begin with
zero or more 'bvar' elements, followed by any other of the elements in
the MathML subset allowed in SBML Level 2 except 'lambda' (i.e., a
'lambda' element cannot contain another 'lambda' element). This is the
only place in SBML where a 'lambda' element can be used. The function
defined by a FunctionDefinition is only available for use in other
MathML elements that follow the FunctionDefinition definition in the
model. (These restrictions prevent recursive and mutually-recursive
functions from being expressed.)
A further restriction on the content of 'math' is that it cannot contain
references to variables other than the variables declared to the
'lambda' itself. That is, the contents of MathML 'ci' elements inside
the body of the 'lambda' can only be the variables declared by its
'bvar' elements, or the identifiers of other FunctionDefinition
instances in the model. This means must be written so that all
variables or parameters used in the MathML content are passed to them
via their function parameters. In SBML Level 2, this restriction
applies also to the MathML csymbol elements for time and
delay in SBML Level 3, it additionally applies to the csymbol
element for avogadro.
FunctionDefinition does not
have a separate attribute for defining the units of the value returned
by the function. The units associated with the function's return value,
when the function is called from within MathML expressions elsewhere in
SBML, are simply the overall units of the expression in
FunctionDefinition's 'math' subelement when applied to the arguments
supplied in the call to the function. Ascertaining these units requires
performing dimensional analysis on the expression. (Readers may wonder
why there is no attribute. The reason is that having a separate
attribute for declaring the units would not only be redundant, but also
lead to the potential for having conflicting information. In the case
of a conflict between the declared units and those of the value actually
returned by the function, the only logical resolution rule would be to
assume that the correct units are those of the expression anyway.)| Constructor and Description |
|---|
FunctionDefinition(FunctionDefinition orig)
Copy constructor creates a copy of this
FunctionDefinition. |
FunctionDefinition(long level,
long version)
|
FunctionDefinition(SBMLNamespaces sbmlns)
|
| Modifier and Type | Method and Description |
|---|---|
FunctionDefinition |
cloneObject()
Creates and returns a deep copy of this
FunctionDefinition object. |
void |
delete()
Explicitly deletes the underlying native object.
|
ASTNode |
getArgument(long n)
Get the
nth argument to this function. |
ASTNode |
getArgument(java.lang.String name)
Get the argument named
name to this FunctionDefinition. |
ASTNode |
getBody()
Get the mathematical expression that is the body of this
FunctionDefinition object. |
java.lang.String |
getElementName()
Returns the XML element name of this object, which for
FunctionDefinition, is always 'functionDefinition'. |
java.lang.String |
getId()
Returns the value of the 'id' attribute of this
FunctionDefinition. |
ASTNode |
getMath()
Get the mathematical formula of this
FunctionDefinition. |
java.lang.String |
getName()
Returns the value of the 'name' attribute of this
FunctionDefinition. |
long |
getNumArguments()
Get the number of arguments (bound variables) taken by this
FunctionDefinition. |
int |
getTypeCode()
Returns the libSBML type code for this SBML object.
|
boolean |
hasRequiredAttributes()
Predicate returning
true if
all the required attributes for this FunctionDefinition object
have been set. |
boolean |
hasRequiredElements()
Predicate returning
true if
all the required elements for this FunctionDefinition object
have been set. |
boolean |
isSetBody()
Predicate returning
true if the body of this
FunctionDefinition has set. |
boolean |
isSetId()
Predicate returning
true if this
FunctionDefinition's 'id' attribute is set. |
boolean |
isSetMath()
Predicate returning
true if this
FunctionDefinition's 'math' subelement contains a value. |
boolean |
isSetName()
Predicate returning
true if this
FunctionDefinition's 'name' attribute is set. |
void |
renameUnitSIdRefs(java.lang.String oldid,
java.lang.String newid)
Renames all the
UnitSIdRef attributes on this element. |
int |
setId(java.lang.String sid)
Sets the value of the 'id' attribute of this
FunctionDefinition. |
int |
setMath(ASTNode math)
Sets the 'math' subelement of this
FunctionDefinition to the Abstract
Syntax Tree given in math. |
int |
setName(java.lang.String name)
Sets the value of the 'name' attribute of this
FunctionDefinition. |
int |
unsetName()
Unsets the value of the 'name' attribute of this
FunctionDefinition. |
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, connectToChild, deleteDisabledPlugins, deleteDisabledPlugins, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getDisabledPlugin, getElementByMetaId, getElementBySId, getLevel, getLine, getListOfAllElements, getListOfAllElements, getListOfAllElementsFromPlugins, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumDisabledPlugins, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getPrefix, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, isSetUserData, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetId, unsetMetaId, unsetModelHistory, unsetNotes, unsetSBOTerm, unsetUserDatapublic FunctionDefinition(long level, long version) throws SBMLConstructorException
level - a long integer, the SBML Level to assign to this FunctionDefinition
version - a long integer, the SBML Version to assign to this
FunctionDefinition
SBMLConstructorException - Thrown if the given level and version combination are invalid
or if this object is incompatible with the given level and version.
SBMLDocument having a different
combination of SBML Level, Version and XML namespaces than the object
itself will result in an error at the time a caller attempts to make the
addition. A parent object must have compatible Level, Version and XML
namespaces. (Strictly speaking, a parent may also have more XML
namespaces than a child, but the reverse is not permitted.) The
restriction is necessary to ensure that an SBML model has a consistent
overall structure. This requires callers to manage their objects
carefully, but the benefit is increased flexibility in how models can be
created by permitting callers to create objects bottom-up if desired. In
situations where objects are not yet attached to parents (e.g.,
SBMLDocument), knowledge of the intented SBML Level and Version help
libSBML determine such things as whether it is valid to assign a
particular value to an attribute.public FunctionDefinition(SBMLNamespaces sbmlns) throws SBMLConstructorException
FunctionDefinition 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 sbmlns is inconsistent or incompatible
with this object.
SBMLDocument having a different
combination of SBML Level, Version and XML namespaces than the object
itself will result in an error at the time a caller attempts to make the
addition. A parent object must have compatible Level, Version and XML
namespaces. (Strictly speaking, a parent may also have more XML
namespaces than a child, but the reverse is not permitted.) The
restriction is necessary to ensure that an SBML model has a consistent
overall structure. This requires callers to manage their objects
carefully, but the benefit is increased flexibility in how models can be
created by permitting callers to create objects bottom-up if desired. In
situations where objects are not yet attached to parents (e.g.,
SBMLDocument), knowledge of the intented SBML Level and Version help
libSBML determine such things as whether it is valid to assign a
particular value to an attribute.public FunctionDefinition(FunctionDefinition orig) throws SBMLConstructorException
FunctionDefinition.
orig - the object to copy.SBMLConstructorExceptionpublic 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 FunctionDefinition.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 FunctionDefinition.delete() themselves.
public FunctionDefinition cloneObject()
FunctionDefinition object.
cloneObject in class SBaseFunctionDefinition object.public java.lang.String getId()
FunctionDefinition.
getId in class SBaseFunctionDefinition.public java.lang.String getName()
FunctionDefinition.
getName in class SBaseFunctionDefinition.public ASTNode getMath()
FunctionDefinition.
ASTNode, the value of the 'math' subelement of this
FunctionDefinitionpublic boolean isSetId()
true if this
FunctionDefinition's 'id' attribute is set.
isSetId in class SBasetrue if the 'id' attribute of this FunctionDefinition is
set, false otherwise.public boolean isSetName()
true if this
FunctionDefinition's 'name' attribute is set.
isSetName in class SBasetrue if the 'name' attribute of this FunctionDefinition is
set, false otherwise.public boolean isSetMath()
true if this
FunctionDefinition's 'math' subelement contains a value.
true if the 'math' for this FunctionDefinition is set,
false otherwise.public int setId(java.lang.String sid)
FunctionDefinition.
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 SBasesid - the string to use as the identifier of this FunctionDefinition
public int setName(java.lang.String name)
FunctionDefinition.
The string in name is copied.
setName in class SBasename - the new name for the FunctionDefinition
public int setMath(ASTNode math)
FunctionDefinition to the Abstract
Syntax Tree given in math.
math - an AST containing the mathematical expression to
be used as the formula for this FunctionDefinition.
public int unsetName()
FunctionDefinition.
public ASTNode getArgument(long n)
nth argument to this function.
Callers should first find out the number of arguments to the function by calling getNumArguments().
n - an integer index for the argument sought.
FunctionDefinition.
FunctionDefinition.getNumArguments()public ASTNode getArgument(java.lang.String name)
name to this FunctionDefinition.
name - the exact name (case-sensitive) of the sought-after
argument
null if
no such argument exists.public ASTNode getBody()
FunctionDefinition object.
FunctionDefinition as an Abstract Syntax
Tree, or null if no body is defined.public boolean isSetBody()
true if the body of this
FunctionDefinition has set.
true if the body of this FunctionDefinition is
set, false otherwise.public long getNumArguments()
FunctionDefinition.
FunctionDefinition.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 SBML_.
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 SBaseSBML_FUNCTION_DEFINITION (default).
FunctionDefinition.getElementName(),
SBase.getPackageName()public java.lang.String getElementName()
FunctionDefinition, is always 'functionDefinition'.
getElementName in class SBase'functionDefinition'.public boolean hasRequiredAttributes()
true if
all the required attributes for this FunctionDefinition object
have been set.
The required attributes for a FunctionDefinition object are:
hasRequiredAttributes in class SBasetrue if the required attributes have been set, false
otherwise.public boolean hasRequiredElements()
true if
all the required elements for this FunctionDefinition object
have been set.
hasRequiredElements in class SBaseFunctionDefinition object are:
public 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 SBaseoldid - the old identifiernewid - the new identifier