public class CompSBMLDocumentPlugin extends SBMLDocumentPlugin
SBMLDocument
.
The CompSBMLDocumentPlugin
class inherits from the SBMLDocumentPlugin
class, and codifies the extensions to the SBMLDocument
class defined in
the SBML Level 3 Hierarchical Model Composition (&ldquocomp&rdquo) package. This
extension allows multiple Model
objects to be defined in a single
SBMLDocument
, stored in an optional child ListOfModelDefinitions
object,
as well as define references to Model
objects in other files, stored in
the optional child ListOfExternalModelDefinitions
object. These model
definitions, if present, allow Submodel
objects to reference other Models
to instantiate.
The presence of any ModelDefinition
or ExternalModelDefinition
in an
SBMLDocument
does not change the default Model
in the file. If a
SBMLDocument
is submitted somewhere to be simulated, it is still the
<model>
child of the <sbml>
element
that should be simulated.
In addition, as all packages do, the CompSBMLDocumentPlugin
defines a
required flag named required
, which indicates whether
&ldquocomp&rdquo constructs can be used to change the core mathematics of the
<model>
child of the <sbml>
element.
Because they can, this attribute must be set true.
Constructor and Description |
---|
CompSBMLDocumentPlugin(CompSBMLDocumentPlugin orig)
Copy constructor.
|
CompSBMLDocumentPlugin(java.lang.String uri,
java.lang.String prefix,
CompPkgNamespaces compns)
Creates a new
CompSBMLDocumentPlugin object using the given parameters. |
Modifier and Type | Method and Description |
---|---|
int |
addExternalModelDefinition(ExternalModelDefinition externalModelDefinition)
Adds a copy of the given
ExternalModelDefinition object to the
ListOfExternalModelDefinitions . |
int |
addModelDefinition(ModelDefinition modelDefinition)
Adds a copy of the given
ModelDefinition object to the
ListOfModelDefinitions . |
SBasePlugin |
cloneObject()
Creates and returns a deep copy of this
CompSBMLDocumentPlugin object. |
ExternalModelDefinition |
createExternalModelDefinition()
Creates a
ExternalModelDefinition object, adds it to the end of the
ExternalModelDefinition objects list and returns a pointer to the newly
created object. |
ModelDefinition |
createModelDefinition()
Creates a
ModelDefinition object, adds it to the end of the
ModelDefinition objects list and returns a pointer to the newly
created object. |
void |
delete()
Explicitly deletes the underlying native object.
|
SBase |
getElementByMetaId(java.lang.String metaid)
Returns the first child element it can find with the given
metaid , or
itself if it has 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. |
ExternalModelDefinition |
getExternalModelDefinition(long n)
Returns the
ExternalModelDefinition with the given index. |
ExternalModelDefinition |
getExternalModelDefinition(java.lang.String sid)
Returns the model definition object based on its identifier.
|
ListOfExternalModelDefinitions |
getListOfExternalModelDefinitions()
Returns the
ListOf object that holds each ExternalModelDefinition . |
ListOfModelDefinitions |
getListOfModelDefinitions()
Returns the
ListOf object that holds each ModelDefinition . |
SBase |
getModel(java.lang.String sid)
Searches the model namespace of the document and returns the
Model ,
ModelDefinition , or ExternalModelDefintion object with the given
identifier. |
ModelDefinition |
getModelDefinition(long n)
Returns the
ModelDefinition with the given index. |
ModelDefinition |
getModelDefinition(java.lang.String sid)
Returns the model definition object based on its identifier.
|
long |
getNumExternalModelDefinitions()
Returns the number of
ExternalModelDefinition objects for this SBMLDocumentPlugin . |
long |
getNumModelDefinitions()
Returns the number of
ModelDefinition objects for this SBMLDocumentPlugin . |
ExternalModelDefinition |
removeExternalModelDefinition(long index)
Removes the
ExternalModelDefinition with the given index. |
ExternalModelDefinition |
removeExternalModelDefinition(java.lang.String id)
Removes the
ExternalModelDefinition with the given id . |
ModelDefinition |
removeModelDefinition(long index)
Removes the
ModelDefinition with the given index from the CompSBMLDocumentPlugin . |
ModelDefinition |
removeModelDefinition(java.lang.String id)
|
int |
setRequired(boolean value)
Sets the boolean value of 'required' attribute of corresponding package
in
SBMLDocument element. |
getRequired, isSetRequired, unsetRequired
getElementNamespace, getLevel, getListOfAllElements, getListOfAllElements, getPackageName, getPackageVersion, getParentSBMLObject, getPrefix, getSBMLDocument, getURI, getVersion, isValidTypeForList, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, setElementNamespace
public CompSBMLDocumentPlugin(java.lang.String uri, java.lang.String prefix, CompPkgNamespaces compns)
CompSBMLDocumentPlugin
object using the given parameters.
In the XML representation of an SBML document, XML namespaces are used to
identify the origin of each XML construct used. XML namespaces are
identified by their unique resource identifiers (URIs). The core SBML
specifications stipulate the namespaces that must be used for core SBML
constructs for example, all XML elements that belong to SBML Level 3
Version 1 Core must be placed in the XML namespace identified by the URI
'http://www.sbml.org/sbml/level3/version1/core'
. Individual
SBML Level 3 packages define their own XML namespaces for example,
all elements belonging to the SBML Level 3 Layout Version 1
package must be placed in the XML namespace
'http://www.sbml.org/sbml/level3/version1/layout/version1/'
.
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.
uri
- the URI of the SBML Level 3 package implemented by
this libSBML package extension.
prefix
- the XML namespace prefix being used for the package.
compns
- the namespaces object for the package.public CompSBMLDocumentPlugin(CompSBMLDocumentPlugin orig)
CompSBMLDocumentPlugin
object.
orig
- the instance to copy.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 CompSBMLDocumentPlugin.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 CompSBMLDocumentPlugin.delete()
themselves.
delete
 in class SBMLDocumentPlugin
public SBasePlugin cloneObject()
CompSBMLDocumentPlugin
object.
cloneObject
 in class SBMLDocumentPlugin
CompSBMLDocumentPlugin
object.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 SBasePlugin
id
- string representing the identifier of the object to find.
SBase
element with the given id
.
ModelDefinition
objects.public SBase getElementByMetaId(java.lang.String metaid)
metaid
, or
itself if it has the given metaid
, or null
if no such object is
found.
getElementByMetaId
 in class SBasePlugin
metaid
- string representing the meta identifier of the object to find.
SBase
element with the given metaid
.public ListOfModelDefinitions getListOfModelDefinitions()
ListOf
object that holds each ModelDefinition
.
ListOf
object that holds each ModelDefinition
.public ModelDefinition getModelDefinition(long n)
ModelDefinition
with the given index.
n
- the index number of the ModelDefinition
to get.
ModelDefinition
in the ListOfModelDefinitions
. If the
index is invalid, null
is returned.public ModelDefinition getModelDefinition(java.lang.String sid)
sid
- a string representing the identifier
of the model definition to get.
ModelDefinition
in the ListOfModelDefinitions
with the given sid
or null
if no such ModelDefinition
exists.
CompSBMLDocumentPlugin.getModelDefinition(long n)
,
CompSBMLDocumentPlugin.getListOfModelDefinitions()
public int addModelDefinition(ModelDefinition modelDefinition)
ModelDefinition
object to the
ListOfModelDefinitions
.
modelDefinition
- the ModelDefinition
object to be added to the
ListOfModelDefinitions
. Fails if the added ModelDefinition
is null
,
does not match the level/version/package of the parent object, or cannot
be added to the list of replaced elements.
public long getNumModelDefinitions()
ModelDefinition
objects for this SBMLDocumentPlugin
.
ModelDefinition
objects.public ModelDefinition createModelDefinition()
ModelDefinition
object, adds it to the end of the
ModelDefinition
objects list and returns a pointer to the newly
created object.
ModelDefinition
object.public ModelDefinition removeModelDefinition(long index)
ModelDefinition
with the given index from the CompSBMLDocumentPlugin
.
A pointer to the ModelDefinition
that was removed is returned.
If no ModelDefinition
has been removed, null
is returned.
index
- the index of the ModelDefinition
object to remove.
ModelDefinition
object removed. As mentioned above,
the caller owns the returned object. null
is returned if
the given index is out of range.public ModelDefinition removeModelDefinition(java.lang.String id)
ModelDefinition
with the given id
from the CompSBMLDocumentPlugin
.
A pointer to the ModelDefinition
that was removed is returned.
If no ModelDefinition
has been removed, null
is returned.
id
- the id of the ModelDefinition
object to remove.
ModelDefinition
object removed. As mentioned above,
the caller owns the returned object. null
is returned if
the given index is out of range.public ListOfExternalModelDefinitions getListOfExternalModelDefinitions()
ListOf
object that holds each ExternalModelDefinition
.
ListOf
object that each all ExternalModelDefinition
.public ExternalModelDefinition getExternalModelDefinition(long n)
ExternalModelDefinition
with the given index.
n
- the index number of the ExternalModelDefinition
to get.
ExternalModelDefinition
in the
ListOfExternalModelDefinitions
. If the index is invalid, null
is
returned.public ExternalModelDefinition getExternalModelDefinition(java.lang.String sid)
sid
- a string representing the identifier
of the model definition to get.
ExternalModelDefinition
in the ListOfExternalModelDefinitions
with the given sid
or null
if no such ExternalModelDefinition
exists.
CompSBMLDocumentPlugin.getExternalModelDefinition(long n)
,
CompSBMLDocumentPlugin.getListOfExternalModelDefinitions()
public SBase getModel(java.lang.String sid)
Model
,
ModelDefinition
, or ExternalModelDefintion object with the given
identifier.
sid
- a string representing the identifier of the model definition to get.
SBase
corresponding to the given sid
or null
if no such
model exists. If no such model exists, this will return null.
public int setRequired(boolean value)
Sets the boolean value of 'required' attribute of corresponding package
in SBMLDocument
element. The only legal value is 'true' for the
Hierarchical Model Composition package.
setRequired
 in class SBMLDocumentPlugin
value
- the boolean value of 'required' attribute of corresponding
package in SBMLDocument
element.
SBMLDocumentPlugin.getRequired()
,
SBMLDocumentPlugin.isSetRequired()
,
SBMLDocumentPlugin.unsetRequired()
public int addExternalModelDefinition(ExternalModelDefinition externalModelDefinition)
ExternalModelDefinition
object to the
ListOfExternalModelDefinitions
.
externalModelDefinition
- the ExternalModelDefinition
object to be
added to the ListOFExternalModelDefinitions. Fails if the added
ExternalModelDefinition
is null
, does not match the
level/version/package of the parent object, or cannot be added to the
list of external model definitions.
public long getNumExternalModelDefinitions()
ExternalModelDefinition
objects for this SBMLDocumentPlugin
.
ExternalModelDefinition
objects for this SBMLDocumentPlugin
.public ExternalModelDefinition createExternalModelDefinition()
ExternalModelDefinition
object, adds it to the end of the
ExternalModelDefinition
objects list and returns a pointer to the newly
created object.
ExternalModelDefinition
object.public ExternalModelDefinition removeExternalModelDefinition(long index)
ExternalModelDefinition
with the given index.
A pointer to the ExternalModelDefinition
that was removed is returned.
If no ExternalModelDefinition
has been removed, null
is returned.
index
- the index of the ExternalModelDefinition
object to remove.
ExternalModelDefinition
object removed. As mentioned above,
the caller owns the returned object. null
is returned if
the given index is out of range.public ExternalModelDefinition removeExternalModelDefinition(java.lang.String id)
ExternalModelDefinition
with the given id
.
A pointer to the ExternalModelDefinition
that was removed is returned.
If no ExternalModelDefinition
has been removed, null
is returned.
id
- the id of the ExternalModelDefinition
object to remove.
ExternalModelDefinition
object removed. As mentioned above,
the caller owns the returned object. null
is returned if
the given index is out of range.