public class CompModelPlugin extends CompSBasePlugin
Model
.
The CompModelPlugin
class inherits from the SBMLSBasePlugin class, and
codifies the extensions to the Model
class defined in the SBML
Level 3 Hierarchical Model Composition (&ldquocomp&rdquo) package. This extension
allows a Model
to define Submodels (other Models that are instantiated as
new parts of the parent Model
), and Ports, a defined interface for
including the given Model
as a Submodel
of a different Model
.
Submodels are stored in an optional child ListOfSubmodels
object, which,
if present, must contain one or more Submodel
objects. All of the Submodels
present in the ListOfSubmodels
are defined to be instantiated in the
'complete' Model
.
Ports are stored in an optional child ListOfPorts
object, which,
if present, must contain one or more Port
objects. All of the Ports
present in the ListOfPorts
collectively define the 'port interface'
of the Model
.
Constructor and Description |
---|
CompModelPlugin(CompModelPlugin orig)
Copy constructor.
|
CompModelPlugin(java.lang.String uri,
java.lang.String prefix,
CompPkgNamespaces compns)
Creates a new
CompModelPlugin object using the given parameters. |
Modifier and Type | Method and Description |
---|---|
int |
addPort(Port port)
Adds a copy of the given
Port object to the list of ports. |
int |
addSubmodel(Submodel submodel)
Adds a copy of the given
Submodel object to the list of submodels. |
SBasePlugin |
cloneObject()
Creates and returns a deep copy of this
CompModelPlugin object. |
Port |
createPort()
Creates a
Port object, adds it to the end of the
port objects list and returns a pointer to the newly
created object. |
Submodel |
createSubmodel()
Creates a
Submodel object, adds it to the end of the
submodel objects list and returns a pointer to the newly
created object. |
void |
delete()
Explicitly deletes the underlying native object.
|
java.lang.String |
getDivider()
Get the string used as the divider between names when renaming and
flattening models.
|
SBase |
getElementByMetaId(java.lang.String metaid)
Returns the first child element it can find with the given meta
identifier, 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. |
ListOfPorts |
getListOfPorts()
Returns the
ListOfPorts from this CompModelPlugin . |
ListOfSubmodels |
getListOfSubmodels()
Returns the
ListOfSubmodels from this CompModelPlugin . |
long |
getNumPorts()
Returns the number of ports for this
CompModelPlugin . |
long |
getNumSubmodels()
Returns the number of submodels for this
CompModelPlugin . |
Port |
getPort(long n)
Returns the port with the given index.
|
Port |
getPort(java.lang.String id)
Returns the port with the given identifier.
|
Submodel |
getSubmodel(long n)
Returns the submodel with the given index.
|
Submodel |
getSubmodel(java.lang.String id)
Returns the submodel with the given identifier.
|
SWIGTYPE_p_PrefixTransformer |
getTransformer()   |
boolean |
isSetTransformer()   |
Port |
removePort(long index)
Removes the port with the given index.
|
Submodel |
removeSubmodel(long index)
Removes the submodel with the given index.
|
int |
setDivider(java.lang.String divider)
Set the string used as the divider between names when renaming and
flattening models.
|
void |
setTransformer(SWIGTYPE_p_PrefixTransformer transformer)
Sets the custom transformer that is to be used, instead of the standard
prefixing with the given divider.
|
void |
unsetTransformer()
Unsets any custom prefix transformers.
|
addReplacedElement, clearReplacedElements, createReplacedBy, createReplacedElement, getListOfReplacedElements, getNumReplacedElements, getReplacedBy, getReplacedElement, isSetReplacedBy, logInvalidId, removeReplacedElement, setReplacedBy, unsetReplacedBy
getElementNamespace, getLevel, getListOfAllElements, getListOfAllElements, getPackageName, getPackageVersion, getParentSBMLObject, getPrefix, getSBMLDocument, getURI, getVersion, isValidTypeForList, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, setElementNamespace
public CompModelPlugin(java.lang.String uri, java.lang.String prefix, CompPkgNamespaces compns)
CompModelPlugin
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 CompModelPlugin(CompModelPlugin orig)
CompModelPlugin
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 CompModelPlugin.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 CompModelPlugin.delete()
themselves.
delete
 in class CompSBasePlugin
public SBasePlugin cloneObject()
CompModelPlugin
object.
cloneObject
 in class CompSBasePlugin
CompModelPlugin
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 CompSBasePlugin
id
- a string representing the id of the object to find.
SBase
element with the given id
.public SBase getElementByMetaId(java.lang.String metaid)
metaid
, or null
if no
such object is found.
getElementByMetaId
 in class CompSBasePlugin
metaid
- a string representing the metaid of the object to find.
SBase
element with the given metaid
.public ListOfSubmodels getListOfSubmodels()
ListOfSubmodels
from this CompModelPlugin
.
ListOfSubmodels
from this CompModelPlugin
.
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
CompModelPlugin.addSubmodel(Submodel object)
,
CompModelPlugin.createSubmodel()
,
CompModelPlugin.getSubmodel(String sid)
,
CompModelPlugin.getSubmodel(long n)
,
CompModelPlugin.getNumSubmodels()
,
#removeSubmodel(String sid)
,
CompModelPlugin.removeSubmodel(long n)
public Submodel getSubmodel(long n)
null
is returned.
n
- the index number of the Submodel
to get.
Submodel
in the ListOfSubmodels
.public Submodel getSubmodel(java.lang.String id)
id
- the identifier of the Submodel
to get.
Submodel
in the ListOfSubmodels
with the given identifier.
If no such submodel with identifier id
exists, null
is returned.public int addSubmodel(Submodel submodel)
Submodel
object to the list of submodels.
Fails if the added submodel is null
, does not match the
level/version/package of the parent object, or cannot be added to the
list of submodels.
submodel
- the Submodel
object to be added to the list of
submodels.
public long getNumSubmodels()
CompModelPlugin
.
CompModelPlugin
.public Submodel createSubmodel()
Submodel
object, adds it to the end of the
submodel objects list and returns a pointer to the newly
created object.
Submodel
object.public Submodel removeSubmodel(long index)
public ListOfPorts getListOfPorts()
ListOfPorts
from this CompModelPlugin
.
ListOfPorts
from this CompModelPlugin
.
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
CompModelPlugin.addPort(Port object)
,
CompModelPlugin.createPort()
,
CompModelPlugin.getPort(String sid)
,
CompModelPlugin.getPort(long n)
,
CompModelPlugin.getNumPorts()
,
#removePort(String sid)
,
CompModelPlugin.removePort(long n)
public Port getPort(long n)
n
- the index number of the Port
to get.
Port
in the ListOfPorts
. If the index n
is invalid,
null
is returned.public Port getPort(java.lang.String id)
id
- the id of the Port
to get.
Port
in the ListOfPorts
with the given identifier. If the
identifier is invalid, null
is returned.public int addPort(Port port)
Port
object to the list of ports.
port
- the Port
object to be added to the list of ports. Fails if
the added port is null
, does not match the level/version/package of the
parent object, or cannot be added to the list of ports.
public long getNumPorts()
CompModelPlugin
.
CompModelPlugin
.public Port createPort()
Port
object, adds it to the end of the
port objects list and returns a pointer to the newly
created object.
Port
object.public Port removePort(long index)
public int setDivider(java.lang.String divider)
The divider string consists of two underscore characters
("__
") by default. This method will fail if called
with an empty divider
, or a divider
that cannot be used internally as part
of a valid SBML SId.
public java.lang.String getDivider()
The divider string consists of two underscore characters
("__
") by default, and can be overridden
with the setDivider() function.
CompModelPlugin.setDivider(String divider)
public void setTransformer(SWIGTYPE_p_PrefixTransformer transformer)
If not set, only ids and meta ids will be prefixed.
NOTE: the model plugin only holds the pointer to the element it does not take ownership of it. Thus the calling program is responsible of freeing the transformer when no longer needed (i.e after the SBML document has been deleted)
transformer
- the prefix transformer to use.public SWIGTYPE_p_PrefixTransformer getTransformer()
public boolean isSetTransformer()
public void unsetTransformer()