org.sbml.jsbml
public abstract class AbstractSBase extends AbstractTreeNode implements SBase
SBase
component.Modifier and Type | Class and Description |
---|---|
private static class |
AbstractSBase.NOTES_TYPE |
Modifier and Type | Field and Description |
---|---|
private Annotation |
annotation
Annotations of the SBML component.
|
private java.util.Map<java.lang.String,java.lang.String> |
declaredNamespaces
Contains all the namespaces declared on the XML node with their prefixes.
|
private java.lang.String |
elementNamespace
the namespace which this SBase element belong to.
|
private java.util.SortedMap<java.lang.String,SBasePlugin> |
extensions
Map containing the SBML extension object of additional packages
with the appropriate name space of the package. |
private static java.util.regex.Pattern |
idPattern
Pattern to recognize valid meta-identifier strings for SBML elements.
|
protected java.util.SortedMap<java.lang.String,XMLNode> |
ignoredExtensions
Map containing the ignored package objects. |
protected XMLNode |
ignoredXMLElements
Contains the unknown XML attributes or elements.
|
private static org.apache.log4j.Logger |
logger
A logger for this class.
|
(package private) ValuePair<java.lang.Integer,java.lang.Integer> |
lv
Level and version of the SBML component.
|
private java.lang.String |
metaId
metaid of the SBML component.
|
private XMLNode |
notesXMLNode
notes of the SBML component.
|
private int |
sboTerm
sbo term of the SBML component.
|
private static long |
serialVersionUID
Generated serial version identifier.
|
private static java.util.regex.Pattern |
simpleIdPattern
Pattern to recognize valid meta-identifier strings for SBML elements.
|
listOfListeners, parent, UNKNOWN_ATTRIBUTES, UNKNOWN_ELEMENTS
Constructor and Description |
---|
AbstractSBase()
Creates an AbstractSBase instance.
|
AbstractSBase(int level,
int version)
Creates an
AbstractSBase instance with the given SBML Level and
Version. |
AbstractSBase(SBase sb)
Creates an
AbstractSBase instance from a given AbstractSBase . |
Modifier and Type | Method and Description |
---|---|
boolean |
addCVTerm(CVTerm term)
Adds a
CVTerm . |
void |
addDeclaredNamespace(java.lang.String prefix,
java.lang.String namespace)
Adds an additional name space to the set of declared namespaces of this
SBase . |
void |
addExtension(java.lang.String nameOrUri,
SBasePlugin sbasePlugin)
Adds a
SBasePlugin extension object to this SBase . |
void |
addPlugin(java.lang.String nameOrUri,
SBasePlugin sbasePlugin)
Adds a
SBasePlugin extension object to this SBase . |
void |
appendNotes(java.lang.String notes)
Appends 'notes' to the notes String of this object.
|
void |
appendNotes(XMLNode notes)
Appends notes to the existing notes.
|
protected boolean |
checkLevelAndVersionCompatibility(SBase sbase)
Checks whether or not the given
SBase has the same level and
version configuration than this element. |
abstract AbstractSBase |
clone()
Creates a deep copy of this object, i.e., a new
SBase with the same properties
like this one. |
History |
createHistory()
Creates a new
History and associates it with the annotation of
this element. |
SBasePlugin |
createPlugin(java.lang.String nameOrUri)
Creates a new
SBasePlugin for the given package name or URI
and adds it to this SBase . |
void |
disablePackage(java.lang.String packageURIOrName)
Disables the given SBML Level 3 package on this
SBMLDocument . |
void |
enablePackage(java.lang.String packageURIOrName)
Enables the given SBML Level 3 package on this
SBMLDocument . |
void |
enablePackage(java.lang.String packageURIOrName,
boolean enabled)
Enables or disables the given SBML Level 3 package on this
SBMLDocument . |
boolean |
equals(java.lang.Object object)
|
java.util.List<CVTerm> |
filterCVTerms(CVTerm.Qualifier qualifier)
Returns a list of all the
CVTerm with the given CVTerm.Qualifier . |
java.util.List<java.lang.String> |
filterCVTerms(CVTerm.Qualifier qualifier,
boolean recursive,
java.lang.String... patterns)
Returns a list of resource URIs for the given
CVTerm.Qualifier that match the
given patterns. |
java.util.List<java.lang.String> |
filterCVTerms(CVTerm.Qualifier qualifier,
java.lang.String pattern)
Queries the list of controlled vocabulary terms (
CVTerm ) for those terms whose
CVTerm.Qualifier is of the given type and selects only those resources from
these terms that contain the given pattern. |
java.util.List<java.lang.String> |
filterCVTerms(CVTerm.Qualifier qualifier,
java.lang.String pattern,
boolean recursive)
Returns a list of resource URIs for the given
CVTerm.Qualifier that match the
given pattern. |
void |
fireNodeRemovedEvent()
All
TreeNodeChangeListener instances linked to this
TreeNode are informed about the deletion of this TreeNode
from a parent Object . |
void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
All
TreeNodeChangeListener s are informed about the change in this
TreeNodeWithChangeSupport . |
boolean |
getAllowsChildren() |
Annotation |
getAnnotation()
Returns the content of the 'annotation' sub-element of this object as an
Annotation instance. |
java.lang.String |
getAnnotationString()
Returns the
Annotation of this SBML object as a String . |
javax.swing.tree.TreeNode |
getChildAt(int childIndex) |
int |
getChildCount() |
CVTerm |
getCVTerm(int index)
|
int |
getCVTermCount()
|
java.util.List<CVTerm> |
getCVTerms()
Returns the list of
CVTerm s of this object. |
java.util.Map<java.lang.String,java.lang.String> |
getDeclaredNamespaces()
Returns all the namespaces declared on this object.
|
java.lang.String |
getElementName()
Returns the XML element name of this object.
|
SBasePlugin |
getExtension(java.lang.String nameOrUri)
Returns the
SBasePlugin extension object which matches this package name or URI. |
int |
getExtensionCount()
Returns the number of
SBasePlugin s of this SBase . |
java.util.Map<java.lang.String,SBasePlugin> |
getExtensionPackages()
Returns the map containing all the
SBasePlugin extension objects
of this SBase . |
private int |
getFirstElementIndex(XMLNode curNotes)
Return the index of the first child of type 'Element' for the given
XMLNode . |
History |
getHistory()
Returns the
History instance of this object. |
protected IdManager |
getIdManager(SBase sbase)
|
int |
getLevel()
Returns the SBML Level of the overall SBML document.
|
ValuePair<java.lang.Integer,java.lang.Integer> |
getLevelAndVersion()
Returns the Level and Version combination of this
SBase . |
java.lang.String |
getMetaId()
Returns the metaid of this element.
|
Model |
getModel()
|
java.lang.String |
getNamespace()
Returns the namespace to which this
SBase belong to. |
XMLNode |
getNotes()
Returns an
XMLNode object that represent the notes of this element. |
java.lang.String |
getNotesString()
Returns the notes sub-element of this object as a
String . |
int |
getNumCVTerms()
|
int |
getNumPlugins()
Returns the number of
SBasePlugin s of this SBase . |
SBase |
getParent()
This is equivalent to calling
getParentSBMLObject() , but this
method is needed for TreeNode . |
SBase |
getParentSBMLObject()
Returns the parent of this
SBase . |
SBasePlugin |
getPlugin(java.lang.String nameOrUri)
Returns an
SBasePlugin for an SBML Level 3 package extension
with the given package name or URI. |
SBMLDocument |
getSBMLDocument()
Returns the parent
SBMLDocument object. |
int |
getSBOTerm()
Grants access to the Systems Biology Ontology (SBO) term associated with
this
SBase . |
java.lang.String |
getSBOTermID()
Grants access to the Systems Biology Ontology (SBO) term associated with
this
SBase . |
int |
getVersion()
Returns the Version within the SBML Level of the overall SBML document.
|
int |
hashCode()
Returns a hash code value for this
SBase instance. |
boolean |
hasValidAnnotation()
Returns
true if the Annotation RDF 'about' attribute matches the metaid of this object. |
boolean |
hasValidLevelVersionNamespaceCombination()
Returns
true or false depending on whether this object's
level/version and namespace values correspond to a valid SBML
specification. |
boolean |
isExtendedByOtherPackages()
Returns
true if this object is extended by other packages. |
boolean |
isPackageEnabled(java.lang.String packageURIOrName)
Returns
true if the given SBML Level 3 package is enabled within the containing SBMLDocument . |
boolean |
isPackageURIEnabled(java.lang.String packageURIOrName)
Returns
true if the given SBML Level 3 package is enabled within the containing SBMLDocument . |
boolean |
isPkgEnabled(java.lang.String packageURIOrName)
Deprecated.
|
boolean |
isPkgURIEnabled(java.lang.String packageURIOrName)
Deprecated.
|
boolean |
isSetAnnotation()
Returns
true or false depending on whether this object's
'annotation' sub-elements exists and have some content. |
boolean |
isSetHistory()
Returns
true if the History instance of this object is set. |
boolean |
isSetLevel()
Returns
true if the level is set. |
boolean |
isSetLevelAndVersion()
Returns
true if both, Level and Version are set for this
SBase . |
boolean |
isSetMetaId()
Returns
true or false depending on whether this object's
'metaid' attribute has been set. |
boolean |
isSetNotes()
Returns
true or false depending on whether this object's
'notes' sub-element exists and has content. |
boolean |
isSetParentSBMLObject()
Check whether this
SBase has been linked to a parent within the
hierarchical SBML data structure. |
boolean |
isSetPlugin(java.lang.String nameOrUri)
Returns
true if an SBasePlugin is defined
for the given package. |
boolean |
isSetSBOTerm()
Returns
true if the SBOTerm is set. |
boolean |
isSetVersion()
Returns
true if the version is not null . |
static boolean |
isValidLevelAndVersionCombination(int level,
int version)
Returns
true if the level and version combination is a valid one, false otherwise. |
static boolean |
isValidMetaId(java.lang.String idCandidate)
Checks if the given identifier candidate satisfies the requirements for a
valid meta identifier (see SBML L2V4 p.
|
protected void |
notifyChildChange(javax.swing.tree.TreeNode oldChild,
javax.swing.tree.TreeNode newChild)
This method is called when one child has been swapped with another one
and can be used to check certain properties of the resulting changed
tree.
|
boolean |
readAttribute(java.lang.String attributeName,
java.lang.String prefix,
java.lang.String value)
Sets the given attribute in this
SBase . |
void |
registerChild(SBase sbase)
Sets this object as SBML parent of 'sbase'.
|
private void |
registerChild(SBasePlugin sbasePlugin)
|
boolean |
removeCVTerm(CVTerm cvTerm)
Removes the given
CVTerm . |
CVTerm |
removeCVTerm(int index)
Removes the
CVTerm at the given index. |
void |
setAnnotation(Annotation annotation)
Sets the value of the 'annotation' sub-element of this SBML object to a
copy of annotation given as an
Annotation instance. |
void |
setHistory(History history)
Sets the history.
|
void |
setLevel(int level)
Sets the level of this object with 'level'.
|
(package private) boolean |
setLevelAndVersion(int level,
int version,
boolean strict)
Sets recursively the level and version attribute for this element
and all sub-elements.
|
void |
setMetaId(java.lang.String metaId)
Sets the metaid value with 'metaid'.
|
void |
setNamespace(java.lang.String namespace)
Sets the XML namespace to which this
SBase belong. |
void |
setNotes(java.lang.String notes)
Sets the notes with 'notes'.
|
void |
setNotes(XMLNode notes)
Sets the
XMLNode containing the notes sub-element of
this object. |
protected void |
setParentSBML(SBase parent) |
protected void |
setParentSBMLObject(SBase sbase)
Checks the Level/Version configuration of the new parent (if it is
compliant to the one of this
SBase ), adds all changeListeners from
the parent to this SBase , fires a
TreeNodeChangeListener.nodeAdded(TreeNode) event, and and finally,
it will forward the new parent to setParentSBML(SBase) . |
void |
setSBOTerm(int term)
Sets the value of the 'sboTerm' attribute.
|
void |
setSBOTerm(java.lang.String sboid)
Sets the value of the 'sboTerm' attribute.
|
void |
setThisAsParentSBMLObject(SBase sbase)
Deprecated.
|
void |
setVersion(int version)
Sets the version of this object with 'version'.
|
abstract java.lang.String |
toString() |
void |
unregisterChild(SBase sbase)
Unregisters recursively the given SBase from the
Model
and SBMLDocument . |
private void |
unregisterChild(SBasePlugin sbasePlugin)
|
void |
unsetAnnotation()
Unsets the value of the 'annotation' sub-element of this SBML object.
|
void |
unsetCVTerms()
Unsets the list of
CVTerm of this object. |
void |
unsetExtension(java.lang.String nameOrUri)
Unsets the
SBasePlugin extension object which matches this package name or URI. |
void |
unsetHistory()
Unsets the
History of this object. |
void |
unsetMetaId()
Unsets the value of the 'metaid' attribute of this SBML object.
|
void |
unsetNamespace()
Unsets the namespace that is associated to this
SBase . |
void |
unsetNotes()
Unsets the value of the 'notes' sub-element of this SBML object.
|
void |
unsetPlugin(java.lang.String nameOrUri)
Unsets the
SBasePlugin extension object which matches this package name or URI. |
void |
unsetSBOTerm()
Unsets the value of the 'sboTerm' attribute of this SBML object.
|
java.util.Map<java.lang.String,java.lang.String> |
writeXMLAttributes()
Returns a map with all the attributes of this
SBase that
need to be written out in XML. |
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getRoot, getTreeNodeChangeListenerCount, getUserObject, indexOf, isLeaf, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, setParent, userObjectKeySet
finalize, getClass, notify, notifyAll, wait, wait, wait
removeTreeNodeChangeListener
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, getListOfTreeNodeChangeListeners, getRoot, getTreeNodeChangeListenerCount, getUserObject, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeUserObject, userObjectKeySet
private static final java.util.regex.Pattern idPattern
private static final java.util.regex.Pattern simpleIdPattern
private static final org.apache.log4j.Logger logger
private static final long serialVersionUID
private Annotation annotation
private final java.util.Map<java.lang.String,java.lang.String> declaredNamespaces
private final java.util.SortedMap<java.lang.String,SBasePlugin> extensions
Map
containing the SBML extension object of additional packages
with the appropriate name space of the package.protected java.util.SortedMap<java.lang.String,XMLNode> ignoredExtensions
Map
containing the ignored package objects.
Package are considered ignored if JSBML does not support this package or support the package but not the associated namespace.
protected XMLNode ignoredXMLElements
ValuePair<java.lang.Integer,java.lang.Integer> lv
private java.lang.String metaId
private XMLNode notesXMLNode
private int sboTerm
private java.lang.String elementNamespace
public AbstractSBase()
By default, the sboTerm is -1, the
metaid, notes, parentSBMLObject, annotation, and
notes are null
. The level and version are set to -1.
The setOfListeners list and the extensions hash map
are empty.
public AbstractSBase(int level, int version)
AbstractSBase
instance with the given SBML Level and
Version.
By default, the sboTerm is -1, the metaid, notes,
AbstractTreeNode.parent
, annotation
, and notes are null
. The
declaredNamespaces
list and the extensions
Map
are
empty.
level
- the SBML levelversion
- the SBML versionpublic AbstractSBase(SBase sb)
AbstractSBase
instance from a given AbstractSBase
.sb
- an AbstractSBase
object to clonepublic static boolean isValidLevelAndVersionCombination(int level, int version)
true
if the level and version combination is a valid one, false
otherwise.level
- the SBML levelversion
- the SBML versiontrue
if the level and version combination is a valid one, false
otherwise.public static final boolean isValidMetaId(java.lang.String idCandidate)
idCandidate
- true
if the given argument is a valid meta identifier
String
, false
otherwise.public boolean addCVTerm(CVTerm term)
SBase
CVTerm
.public void addDeclaredNamespace(java.lang.String prefix, java.lang.String namespace)
SBase
.addDeclaredNamespace
in interface SBase
prefix
- the prefix of the namespace to addnamespace
- the namespace to addpublic void addExtension(java.lang.String nameOrUri, SBasePlugin sbasePlugin)
SBase
SBasePlugin
extension object to this SBase
.
If a previous SBasePlugin
associated with the same package
was present before, it will be replaced.
addExtension
in interface SBase
nameOrUri
- the name or URI of the package extension.sbasePlugin
- the SBasePlugin
to add.public void addPlugin(java.lang.String nameOrUri, SBasePlugin sbasePlugin)
SBase
SBasePlugin
extension object to this SBase
.
If a previous SBasePlugin
associated with the same package
was present before, it will be replaced.
addPlugin
in interface SBase
nameOrUri
- the name or URI of the package extension.sbasePlugin
- the SBasePlugin
to add.SBase.addExtension(String, SBasePlugin)
public void setNamespace(java.lang.String namespace)
SBase
belong.
This an internal method that should not be used outside of the main jsbml code (core + packages). One class should always belong to the same namespace, although the namespaces can have different level and version (and package version). You have to know what you are doing when using this method.
namespace
- the XML namespace to which this SBase
belong.public void appendNotes(java.lang.String notes) throws javax.xml.stream.XMLStreamException
SBase
appendNotes
in interface SBase
notes
- the notes to be added.javax.xml.stream.XMLStreamException
- if an error occurs while parsing the notes String.public void appendNotes(XMLNode notes)
This allows other notes to be preserved whilst adding additional information.
appendNotes
in interface SBase
notes
- protected boolean checkLevelAndVersionCompatibility(SBase sbase)
SBase
has the same level and
version configuration than this element. If the L/V combination for the
given sbase
is not yet defined, this method sets it to the
identical values as it is for the current object.sbase
- the element to be checked.true
if the given sbase
and this object
have the same L/V configuration.LevelVersionError
- In case the given SBase
has a different, but defined
Level/Version combination than this current SBase
, an
LevelVersionError
is thrown. This method is only
package-wide visible because it is not intended to be a
"real" check, rather than to indicate potential errors.public abstract AbstractSBase clone()
SBase
SBase
with the same properties
like this one.clone
in interface SBase
clone
in class AbstractTreeNode
public History createHistory()
History
and associates it with the annotation of
this element. If no Annotation
exists, a new such element is
created as well.History
instance that is directly associated with
this element.getHistory()
public SBasePlugin createPlugin(java.lang.String nameOrUri)
SBase
SBasePlugin
for the given package name or URI
and adds it to this SBase
.
If an SBasePlugin
was already present in this SBase
it will be replaced.
createPlugin
in interface SBase
nameOrUri
- the package name or URISBasePlugin
for the given package name or URIpublic void disablePackage(java.lang.String packageURIOrName)
SBMLDocument
.disablePackage
in interface SBase
packageURIOrName
- a package namespace URI or package namepublic void enablePackage(java.lang.String packageURIOrName)
SBMLDocument
.enablePackage
in interface SBase
packageURIOrName
- a package namespace URI or package namepublic void enablePackage(java.lang.String packageURIOrName, boolean enabled)
SBMLDocument
.enablePackage
in interface SBase
packageURIOrName
- a package namespace URI or package nameenabled
- a boolean to tell if the package need to be enabled or disabled. It true
the package will be enabled, otherwise it will be disabled.public boolean equals(java.lang.Object object)
SBase
public java.util.List<CVTerm> filterCVTerms(CVTerm.Qualifier qualifier)
SBase
CVTerm
with the given CVTerm.Qualifier
.filterCVTerms
in interface SBase
qualifier
- CVTerm.Qualifier
used to filter the CVTerm
s.CVTerm
with the given CVTerm.Qualifier
.public java.util.List<java.lang.String> filterCVTerms(CVTerm.Qualifier qualifier, java.lang.String pattern)
SBase
CVTerm
) for those terms whose
CVTerm.Qualifier
is of the given type and selects only those resources from
these terms that contain the given pattern.filterCVTerms
in interface SBase
qualifier
- CVTerm.Qualifier
used to filter the CVTerm
s.pattern
- a regexp pattern, for instance, '.*kegg.*' or '.*chebi.*'.Pattern
public java.util.List<java.lang.String> filterCVTerms(CVTerm.Qualifier qualifier, java.lang.String pattern, boolean recursive)
SBase
CVTerm.Qualifier
that match the
given pattern.
This is a recursive implementation of #filterCVTerms(Qualifier, String)
that considers all child elements of the current instance of SBase
as well.
filterCVTerms
in interface SBase
qualifier
- CVTerm.Qualifier
used to filter the CVTerm
s.pattern
- a regexp pattern, for instance, '.*kegg.*' or '.*chebi.*'.recursive
- decides whether or not to consider all child elements of this
SBase
and collecting the matching CVTerm
s of
all children recursively. If this argument is false
, the
behavior of the method will be equivalent to calling
#filterCVTerms(Qualifier, String)
.CVTerm.Qualifier
that match the
given pattern.#filterCVTerms(Qualifier, String)
,
Pattern
public java.util.List<java.lang.String> filterCVTerms(CVTerm.Qualifier qualifier, boolean recursive, java.lang.String... patterns)
SBase
CVTerm.Qualifier
that match the
given patterns.filterCVTerms
in interface SBase
qualifier
- CVTerm.Qualifier
used to filter the CVTerm
s.recursive
- boolean used to decides whether or not to consider all child elements of this
SBase
and collecting the matching CVTerm
s of
all children recursively.patterns
- an arbitrary list of patterns to be matched to the resources of each
CVTerm
.CVTerm.Qualifier
that match the
given pattern.#filterCVTerms(Qualifier, String, boolean)
,
CVTerm.filterResources(String...)
public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
TreeNodeWithChangeSupport
TreeNodeChangeListener
s are informed about the change in this
TreeNodeWithChangeSupport
.firePropertyChange
in interface TreeNodeWithChangeSupport
firePropertyChange
in class AbstractTreeNode
propertyName
- Tells the TreeNodeChangeListener
the name of the
property whose value has been changed.oldValue
- This is the value before the change.newValue
- This gives the new value that is now the new value for the
given property..public void fireNodeRemovedEvent()
TreeNodeWithChangeSupport
TreeNodeChangeListener
instances linked to this
TreeNode
are informed about the deletion of this TreeNode
from a parent Object
.fireNodeRemovedEvent
in interface TreeNodeWithChangeSupport
fireNodeRemovedEvent
in class AbstractTreeNode
public boolean getAllowsChildren()
getAllowsChildren
in interface javax.swing.tree.TreeNode
public Annotation getAnnotation()
SBase
Annotation
instance.getAnnotation
in interface SBase
Annotation
instance.public java.lang.String getAnnotationString() throws javax.xml.stream.XMLStreamException
Annotation
of this SBML object as a String
.getAnnotationString
in interface SBase
Annotation
of this SBML object as a String
or
an empty String
if there are no Annotation
.javax.xml.stream.XMLStreamException
public javax.swing.tree.TreeNode getChildAt(int childIndex)
getChildAt
in interface javax.swing.tree.TreeNode
public int getChildCount()
getChildCount
in interface javax.swing.tree.TreeNode
public int getCVTermCount()
SBase
getCVTermCount
in interface SBase
CVTerm
s of this SBase
.public java.util.List<CVTerm> getCVTerms()
SBase
CVTerm
s of this object.getCVTerms
in interface SBase
CVTerm
s of this object. If not yet set, this method
initializes the annotation and returns an empty list.public java.util.Map<java.lang.String,java.lang.String> getDeclaredNamespaces()
SBase
getDeclaredNamespaces
in interface SBase
public java.lang.String getElementName()
SBase
getElementName
in interface SBase
public SBasePlugin getExtension(java.lang.String nameOrUri)
SBase
SBasePlugin
extension object which matches this package name or URI.getExtension
in interface SBase
nameOrUri
- the package name or URISBasePlugin
extension object which matches this package name or URI,
null is returned if nothing matching the name or URI is found.public int getExtensionCount()
SBase
SBasePlugin
s of this SBase
.getExtensionCount
in interface SBase
SBasePlugin
s of this SBase
.public java.util.Map<java.lang.String,SBasePlugin> getExtensionPackages()
SBase
SBasePlugin
extension objects
of this SBase
.getExtensionPackages
in interface SBase
SBasePlugin
extension objects
of this SBase
.private int getFirstElementIndex(XMLNode curNotes)
XMLNode
.curNotes
- XMLNode
, -1 otherwise.public History getHistory()
SBase
History
instance of this object.getHistory
in interface SBase
History
instance of this object.protected IdManager getIdManager(SBase sbase)
IdManager
that can register the given SBase
.
It means that the method IdManager.accept(SBase)
returned true
.
public int getLevel()
SBase
getLevel
in interface SBase
SBase.getVersion()
public ValuePair<java.lang.Integer,java.lang.Integer> getLevelAndVersion()
SBase
SBase
.getLevelAndVersion
in interface SBase
ValuePair
with the Level and Version of this
SBase
. Note that the returned ValuePair
is never
null
, but if undeclared it may contain elements set to -1.public java.lang.String getMetaId()
SBase
public java.lang.String getNamespace()
SBase
SBase
belong to.getNamespace
in interface SBase
SBase
belong to.public XMLNode getNotes()
XMLNode
object that represent the notes of this element.public java.lang.String getNotesString() throws javax.xml.stream.XMLStreamException
SBase
String
.
If no notes are set, an empty String
will be returned.
getNotesString
in interface SBase
String
. If no
notes are set, an empty String
will be returned.javax.xml.stream.XMLStreamException
- if an error occurs while writing the XMLNode
to a String.public int getNumCVTerms()
SBase
getNumCVTerms
in interface SBase
CVTerm
s of this SBase
.public int getNumPlugins()
SBase
SBasePlugin
s of this SBase
.getNumPlugins
in interface SBase
SBasePlugin
s of this SBase
.public SBase getParent()
getParentSBMLObject()
, but this
method is needed for TreeNode
.getParent
in interface javax.swing.tree.TreeNode
getParent
in class AbstractTreeNode
getParentSBMLObject()
public SBase getParentSBMLObject()
SBase
SBase
.getParentSBMLObject
in interface SBase
TreeNode.getParent()
public SBasePlugin getPlugin(java.lang.String nameOrUri)
SBase
SBasePlugin
for an SBML Level 3 package extension
with the given package name or URI.
If no SBasePlugin
is found for this package, a new SBasePlugin
is created, added to this SBase
and returned.
getPlugin
in interface SBase
nameOrUri
- the name or URI of the packageSBasePlugin
for an SBML Level 3 package extension
with the given package name or URI.public SBMLDocument getSBMLDocument()
SBase
SBMLDocument
object.
LibSBML uses the class SBMLDocument
as a top-level container for storing
SBML content and data associated with it (such as warnings and error
messages). An SBML model in libSBML is contained inside an SBMLDocument
object. SBMLDocument
corresponds roughly to the class 'sbml' defined in the
SBML Level 2 specification, but it does not have a direct correspondence
in SBML Level 1. (But, it is created by libSBML no matter whether the
model is Level 1 or Level 2.)
This method allows the SBMLDocument
for the current object to be
retrieved.getSBMLDocument
in interface SBase
SBMLDocument
object of this SBML object.public int getSBOTerm()
SBase
SBase
.getSBOTerm
in interface SBase
SBO
public java.lang.String getSBOTermID()
SBase
SBase
.getSBOTermID
in interface SBase
SBO
public int getVersion()
SBase
getVersion
in interface SBase
SBase.getLevel()
public int hashCode()
SBase
SBase
instance.hashCode
in interface SBase
hashCode
in class AbstractTreeNode
SBase
instance.Object.hashCode()
public boolean hasValidAnnotation()
SBase
true
if the Annotation
RDF 'about' attribute matches the metaid of this object.hasValidAnnotation
in interface SBase
true
if the Annotation
'about' String
of this
object matches the metaid of this object.public boolean hasValidLevelVersionNamespaceCombination()
SBase
true
or false
depending on whether this object's
level/version and namespace values correspond to a valid SBML
specification.hasValidLevelVersionNamespaceCombination
in interface SBase
true
if this object's level, version and namespace values
correspond to a valid SBML specification.public boolean isExtendedByOtherPackages()
SBase
true
if this object is extended by other packages.isExtendedByOtherPackages
in interface SBase
true
if this object is extended by other packages.public boolean isPackageEnabled(java.lang.String packageURIOrName)
SBase
true
if the given SBML Level 3 package is enabled within the containing SBMLDocument
.isPackageEnabled
in interface SBase
packageURIOrName
- the name or URI of the package extension.true
if the given SBML Level 3 package is enabled within the containing SBMLDocument
, false
otherwise.public boolean isPackageURIEnabled(java.lang.String packageURIOrName)
SBase
true
if the given SBML Level 3 package is enabled within the containing SBMLDocument
.isPackageURIEnabled
in interface SBase
packageURIOrName
- the name or URI of the package extension.true
if the given SBML Level 3 package is enabled within the containing SBMLDocument
, false
otherwise.@Deprecated public boolean isPkgEnabled(java.lang.String packageURIOrName)
SBase
true
if the given SBML Level 3 package is enabled within the containing SBMLDocument
.isPkgEnabled
in interface SBase
packageURIOrName
- the name or URI of the package extension.true
if the given SBML Level 3 package is enabled within the containing SBMLDocument
, false
otherwise.@Deprecated public boolean isPkgURIEnabled(java.lang.String packageURIOrName)
SBase
true
if the given SBML Level 3 package is enabled within the containing SBMLDocument
.isPkgURIEnabled
in interface SBase
packageURIOrName
- the name or URI of the package extension.true
if the given SBML Level 3 package is enabled within the containing SBMLDocument
, false
otherwise.public boolean isSetAnnotation()
SBase
true
or false
depending on whether this object's
'annotation' sub-elements exists and have some content.isSetAnnotation
in interface SBase
true
if the Annotation
instance of this object is not
null
and contains at least one CVTerm
or one
String
containing other annotations than RDF or a
History
instance.public boolean isSetHistory()
SBase
true
if the History
instance of this object is set.isSetHistory
in interface SBase
true
if the History
instance of this object is set.public boolean isSetLevel()
SBase
true
if the level is set.isSetLevel
in interface SBase
true
if the level is set.public boolean isSetLevelAndVersion()
SBase
true
if both, Level and Version are set for this
SBase
.isSetLevelAndVersion
in interface SBase
true
if SBase.isSetLevel()
and
SBase.isSetVersion()
.public boolean isSetMetaId()
SBase
true
or false
depending on whether this object's
'metaid' attribute has been set.isSetMetaId
in interface SBase
true
if the metaid is not null
.public boolean isSetNotes()
SBase
true
or false
depending on whether this object's
'notes' sub-element exists and has content.isSetNotes
in interface SBase
true
if the notes String
is not null
.public boolean isSetParentSBMLObject()
SBase
SBase
has been linked to a parent within the
hierarchical SBML data structure.isSetParentSBMLObject
in interface SBase
true
if this SBase
has a parent SBML object,
false
otherwise.SBase.getParentSBMLObject()
public boolean isSetPlugin(java.lang.String nameOrUri)
SBase
true
if an SBasePlugin
is defined
for the given package.isSetPlugin
in interface SBase
nameOrUri
- the package name or URItrue
if an SBasePlugin
is defined
for the given package.public boolean isSetSBOTerm()
SBase
true
if the SBOTerm is set.isSetSBOTerm
in interface SBase
true
if the SBOTerm is set.SBO
public boolean isSetVersion()
SBase
true
if the version is not null
.isSetVersion
in interface SBase
true
if the version is not null
.protected void notifyChildChange(javax.swing.tree.TreeNode oldChild, javax.swing.tree.TreeNode newChild)
AbstractTreeNode
notifyChildChange
in class AbstractTreeNode
oldChild
- the element that was a child of this node before the change.newChild
- the new child whose new parent is this node.public boolean readAttribute(java.lang.String attributeName, java.lang.String prefix, java.lang.String value)
SBase
SBase
.
If the given attribute name is not recognized, nothing is done and
false
is returned.
readAttribute
in interface SBase
attributeName
- localName of the XML attributeprefix
- prefix of the XML attributevalue
- value of the XML attributetrue
if the attribute has been successfully read.public void registerChild(SBase sbase) throws LevelVersionError
SBase
Exception
is
thrown.registerChild
in interface SBase
sbase
- the SBase
to be registered.LevelVersionError
- In case the given SBase
has a different, but defined
Level/Version combination than this current SBase
, an
LevelVersionError
is thrown.private void registerChild(SBasePlugin sbasePlugin)
sbasePlugin
- the SBasePlugin
to register.public boolean removeCVTerm(CVTerm cvTerm)
CVTerm
.removeCVTerm
in interface SBase
cvTerm
- the CVTerm
to removeCVTerm
was successfully removed.public CVTerm removeCVTerm(int index)
CVTerm
at the given index.removeCVTerm
in interface SBase
index
- the indexCVTerm
.java.lang.IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())public void setAnnotation(Annotation annotation)
SBase
Annotation
instance.setAnnotation
in interface SBase
annotation
- the annotation of this SBase
public void setHistory(History history)
SBase
setHistory
in interface SBase
history
- the history of this SBase
public void setLevel(int level)
SBase
Exception
is thrown.boolean setLevelAndVersion(int level, int version, boolean strict)
level
- the SBML levelversion
- the SBML versionstrict
- a boolean to say if the method need to be strict or not (not used at the moment)true
if the operation as been successful.public void setMetaId(java.lang.String metaId)
SBase
public void setNotes(java.lang.String notes) throws javax.xml.stream.XMLStreamException
SBase
public void setNotes(XMLNode notes)
SBase
XMLNode
containing the notes sub-element of
this object.protected void setParentSBML(SBase parent)
protected void setParentSBMLObject(SBase sbase) throws LevelVersionError
SBase
), adds all changeListeners from
the parent to this SBase
, fires a
TreeNodeChangeListener.nodeAdded(TreeNode)
event, and and finally,
it will forward the new parent to setParentSBML(SBase)
.
Note that this will cause another event to be triggered:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
with the old and the new parent.sbase
- the new parent element.LevelVersionError
- if the SBML Level and Version configuration of the new parent
differs from the one of this SBase
.#setParentSBML(SBase)}
public void setSBOTerm(int term)
SBase
Beginning with SBML Level 2 Version 3, objects derived from SBase
have
an optional attribute named 'sboTerm' for supporting the use of the
Systems Biology Ontology. In SBML proper, the data type of the
attribute is a string of the form 'SBO:NNNNNNN', where 'NNNNNNN' is a
seven digit integer number; JSBML simplifies the representation by
only storing the 'NNNNNNN' integer portion. Thus, in JSBML, the
'sboTerm' attribute on SBase
has data type int
, and SBO
identifiers
are stored simply as integers.
SBO
terms are a type of optional annotation, and each different class
of SBML object derived from SBase
imposes its own requirements about
the values permitted for 'sboTerm'. Please consult the SBML
Level 2 Version 4 specification for more information about
the use of SBO
and the 'sboTerm' attribute.
setSBOTerm
in interface SBase
term
- the NNNNNNN integer portion of the SBO
identifierSBO
public void setSBOTerm(java.lang.String sboid)
SBase
Beginning with SBML Level 2 Version 3, objects derived from SBase
have
an optional attribute named 'sboTerm' for supporting the use of the
Systems Biology Ontology. In SBML proper, the data type of the
attribute is a string of the form 'SBO:NNNNNNN', where 'NNNNNNN' is a
seven digit integer number; JSBML simplifies the representation by
only storing the 'NNNNNNN' integer portion. Thus, in JSBML, the
'sboTerm' attribute on SBase
has data type int
, and SBO
identifiers
are stored simply as integers.
SBO
terms are a type of optional annotation, and each different class
of SBML object derived from SBase
imposes its own requirements about
the values permitted for 'sboTerm'. Please consult the SBML
Level 2 Version 4 specification for more information about
the use of SBO
and the 'sboTerm' attribute.
setSBOTerm
in interface SBase
sboid
- the SBO
identifier of the form 'SBO:NNNNNNN'SBO
@Deprecated public void setThisAsParentSBMLObject(SBase sbase) throws LevelVersionError
SBase
Exception
is
thrown.setThisAsParentSBMLObject
in interface SBase
sbase
- the child SBase
LevelVersionError
public void setVersion(int version)
SBase
Exception
is thrown.setVersion
in interface SBase
version
- the SBML versionpublic abstract java.lang.String toString()
toString
in class AbstractTreeNode
public void unregisterChild(SBase sbase)
SBase
Model
and SBMLDocument
.unregisterChild
in interface SBase
sbase
- the SBase
to be unregistered.private void unregisterChild(SBasePlugin sbasePlugin)
sbasePlugin
- the SBasePlugin
to unregister.public void unsetAnnotation()
SBase
unsetAnnotation
in interface SBase
public void unsetCVTerms()
SBase
CVTerm
of this object.unsetCVTerms
in interface SBase
public void unsetHistory()
SBase
History
of this object.unsetHistory
in interface SBase
public void unsetMetaId()
SBase
unsetMetaId
in interface SBase
public void unsetNamespace()
SBase
.
This is an internal method of JSBML that should be used with caution.
public void unsetNotes()
SBase
unsetNotes
in interface SBase
public void unsetExtension(java.lang.String nameOrUri)
SBase
SBasePlugin
extension object which matches this package name or URI.unsetExtension
in interface SBase
nameOrUri
- the package name or URIpublic void unsetPlugin(java.lang.String nameOrUri)
SBase
SBasePlugin
extension object which matches this package name or URI.unsetPlugin
in interface SBase
nameOrUri
- the package name or URIpublic void unsetSBOTerm()
SBase
unsetSBOTerm
in interface SBase
public java.util.Map<java.lang.String,java.lang.String> writeXMLAttributes()
SBase
SBase
that
need to be written out in XML.
The attribute name is used as a key and the attribute value as value. If a prefix is needed for the attribute name, it need to be set directly in this map.
writeXMLAttributes
in interface SBase
Map
containing the XML attributes of this object.