public class CompSBasePlugin extends SBasePlugin
SBase
.
The CompSBasePlugin
class inherits from the SBasePlugin
class, and
codifies the extensions to the SBase
class defined in the Hierarchical Model Composition
(&ldquocomp&rdquo) package. This extension allows the modeler to define
one or more submodel elements which the parent SBase
object replaces,
and/or a single submodel element which replaces the parent SBase
object.
This is accomplished through the addition of an optional ListOfReplacedElements
child, which may contain one or more ReplacedElement
objects, each of which
references a submodel object to be replaced by the containing SBase
object,
and through the addition of a single optional ReplacedBy
child, which
references a submodel object which is to replace the containing SBase
object.
If a single SBase
element both contains a ListOfReplacedElements
and has a ReplacedBy
child, it and all the referenced ReplacedElement
objects are to be replaced
by the object referenced by the ReplacedBy
element.
ReplacedElement
,
ReplacedBy
Constructor and Description |
---|
CompSBasePlugin(CompSBasePlugin orig)
Copy constructor.
|
CompSBasePlugin(java.lang.String uri,
java.lang.String prefix,
CompPkgNamespaces compns)
Creates a new
CompSBasePlugin object using the given parameters. |
Modifier and Type | Method and Description |
---|---|
int |
addReplacedElement(ReplacedElement replacedElement)
Adds a copy of the given
ReplacedElement object to the list of ReplacedElements. |
void |
clearReplacedElements()
Remove all ReplacedElements, if any exist.
|
SBasePlugin |
cloneObject()
Creates and returns a deep copy of this
CompSBasePlugin object. |
ReplacedBy |
createReplacedBy()
Creates a new, empty
ReplacedBy , adds it to this CompSBasePlugin and
returns the created ReplacedBy . |
ReplacedElement |
createReplacedElement()
Creates a
ReplacedElement object, adds it to the end of the
ReplacedElement 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. |
ListOfReplacedElements |
getListOfReplacedElements()
Returns the
ListOf object that holds all replacedElements. |
long |
getNumReplacedElements()
Returns the number of ReplacedElements for this
CompSBasePlugin . |
ReplacedBy |
getReplacedBy()
Get the child
ReplacedBy of this SBase . |
ReplacedElement |
getReplacedElement(long n)
Returns the
ReplacedElement with the given index. |
boolean |
isSetReplacedBy()
Predicate for testing whether the
ReplacedBy for this SBase is set. |
void |
logInvalidId(java.lang.String attribute,
java.lang.String wrongattribute)
Helper to log a common type of error.
|
ReplacedElement |
removeReplacedElement(long index)
Removes the
ReplacedElement with the given index. |
int |
setReplacedBy(ReplacedBy replacedBy)
|
int |
unsetReplacedBy()
Unsets the child
ReplacedBy of this SBase . |
getElementNamespace, getLevel, getListOfAllElements, getListOfAllElements, getPackageName, getPackageVersion, getParentSBMLObject, getPrefix, getSBMLDocument, getURI, getVersion, isValidTypeForList, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, setElementNamespace
public CompSBasePlugin(java.lang.String uri, java.lang.String prefix, CompPkgNamespaces compns)
CompSBasePlugin
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 CompSBasePlugin(CompSBasePlugin orig)
CompSBasePlugin
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 CompSBasePlugin.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 CompSBasePlugin.delete()
themselves.
delete
 in class SBasePlugin
public SBasePlugin cloneObject()
CompSBasePlugin
object.
cloneObject
 in class SBasePlugin
CompSBasePlugin
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 id of the object to find.
SBase
element with the given id
.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 metaid of the object to find.
SBase
element with the given metaid
.public ListOfReplacedElements getListOfReplacedElements()
ListOf
object that holds all replacedElements.
ListOf
object that holds all replacedElements.public ReplacedElement getReplacedElement(long n)
ReplacedElement
with the given index.
n
- the index number of the ReplacedElement
to get.
ReplacedElement
in the ListOfReplacedElements
. If the
index is invalid, null
is returned.public int addReplacedElement(ReplacedElement replacedElement)
ReplacedElement
object to the list of ReplacedElements.
replacedElement
- the ReplacedElement
object to be added to the
list of ReplacedElements. Fails if the added ReplacedElement
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 getNumReplacedElements()
CompSBasePlugin
.
CompSBasePlugin
.public void clearReplacedElements()
public ReplacedElement createReplacedElement()
ReplacedElement
object, adds it to the end of the
ReplacedElement
objects list and returns a pointer to the newly
created object.
ReplacedElement
object.public ReplacedElement removeReplacedElement(long index)
ReplacedElement
with the given index.
A pointer to the ReplacedElement
that was removed is returned.
If no ReplacedElement
has been removed, null
is returned.
index
- the index of the ReplacedElement
object to remove.
ReplacedElement
object removed. As mentioned above,
the caller owns the returned object. null
is returned if
the given index is out of range.public ReplacedBy getReplacedBy()
ReplacedBy
of this SBase
.
ReplacedBy
child of this SBase
.public boolean isSetReplacedBy()
ReplacedBy
for this SBase
is set.
true
if the ReplacedBy
of this SBase
is set, false
otherwise.public int setReplacedBy(ReplacedBy replacedBy)
ReplacedBy
definition of this SBase
to a copy of the given
ReplacedBy
object instance.
This method fails if the added ReplacedBy
does not match the
level/version/package of the parent object or if the added ReplacedBy
cannot be copied.
replacedBy
- the ReplacedBy
object instance to use.
public ReplacedBy createReplacedBy()
ReplacedBy
, adds it to this CompSBasePlugin
and
returns the created ReplacedBy
.
ReplacedBy
object instance.public int unsetReplacedBy()
public void logInvalidId(java.lang.String attribute, java.lang.String wrongattribute)