public class CompSBasePlugin extends SBasePlugin
SBase
.
The CompSBasePlugin
class inherits from the SBasePlugin
class,
and codifies the extentions to the SBase
class defined in the
'Hierarchical Model Composition'
package (&ldquocomp&rdquo). This extention 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)
Constructor.
|
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)
public CompSBasePlugin(CompSBasePlugin orig)
CompSBasePlugin
object.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
objectpublic 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 objects 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 objects 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
objectpublic 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 instancepublic int unsetReplacedBy()
public void logInvalidId(java.lang.String attribute, java.lang.String wrongattribute)