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 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 java.util.SortedSet<java.lang.String> |
usedNamespaces
Contains all the namespaces used by this SBase element.
|
listOfListeners, parent
Constructor and Description |
---|
AbstractSBase()
Creates an AbstractSBase instance.
|
AbstractSBase(int level,
int version)
Creates an
AbstractSBase instance with the given Level and
Version. |
AbstractSBase(SBase sb)
Creates an AbstractSBase instance from a given AbstractSBase.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addCVTerm(CVTerm term) |
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 |
addNamespace(java.lang.String namespace)
Adds an additional namespace to the set of namespaces of this
SBase if the given namespace is not yet present within this
SortedSet . |
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 copy of this object, i.e., e new
SBase with the same properties
like this one and returns a pointer to it. |
private History |
createHistory() |
boolean |
equals(java.lang.Object object)
|
java.util.List<CVTerm> |
filterCVTerms(CVTerm.Qualifier qualifier)
This method returns a list of all qualifiers of the given type.
|
java.util.List<java.lang.String> |
filterCVTerms(CVTerm.Qualifier qualifier,
java.lang.String pattern)
Queries the list of controlled vocabulary terms for those terms whose
qualifier is of the given type and selects only those resources from
these terms that contain the given pattern.
|
void |
fireNodeRemovedEvent()
All
TreeNodeChangeListener instances linked to this
TreeNode are informed about the deletion of this TreeNode
from a parent Object . |
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) |
java.util.List<CVTerm> |
getCVTerms() |
java.util.Map<java.lang.String,java.lang.String> |
getDeclaredNamespaces()
Returns all the namespaces declared on this object.
|
java.lang.String |
getElementName() |
History |
getHistory() |
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() |
Model |
getModel()
|
java.util.SortedSet<java.lang.String> |
getNamespaces()
Returns all the namespaces of all the packages which are currently
extending this object.
|
XMLNode |
getNotes()
Returns an
XMLNode object that represent the notes of this element. |
java.lang.String |
getNotesString() |
int |
getNumCVTerms() |
SBase |
getParent()
This is equivalent to calling
getParentSBMLObject() , but this
method is needed for TreeNode . |
SBase |
getParentSBMLObject()
This method is convenient when holding an object nested inside other
objects in an SBML model.
|
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() |
boolean |
hasValidAnnotation() |
boolean |
hasValidLevelVersionNamespaceCombination()
Predicate returning
true or false depending on whether this object's
level/version and name space values correspond to a valid SBML
specification. |
boolean |
isSetAnnotation()
Predicate returning true or false depending on whether this object's
'annotation' sub-element exists and has content.
|
boolean |
isSetHistory() |
boolean |
isSetLevel() |
boolean |
isSetLevelAndVersion()
Returns
true if both, Level and Version are set for this
SBase . |
boolean |
isSetMetaId()
Predicate returning true or false depending on whether this object's
'metaid' attribute has been set.
|
boolean |
isSetNotes()
Predicate returning 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 |
isSetSBOTerm() |
boolean |
isSetVersion() |
static boolean |
isValidLevelAndVersionCombination(int level,
int version)
Returns true is the level and version combination is a valid one, false otherwise.
|
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)
If the attribute is an id or name attribute, it will set the id or name
of this object with the value of the XML attribute ('value').
|
void |
registerChild(SBase sbase)
Sets this object as SBML parent of 'sbase'.
|
boolean |
removeNamespace(java.lang.String namespace) |
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) |
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 |
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)
Sets this object as SBML parent of 'sbase'.
|
void |
setVersion(int version)
Sets the version of this object with 'version'.
|
abstract java.lang.String |
toString() |
void |
unregister(SBase sbase)
Unregisters recursively the given SBase from the
Model
and SBMLDocument . |
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 |
unsetHistory()
Unsets the
History of this object. |
void |
unsetMetaId()
Unsets the value of the 'metaid' attribute of this SBML object.
|
void |
unsetNotes()
Unsets the value of the 'notes' sub-element of this SBML object.
|
void |
unsetSBOTerm()
Unsets the value of the 'sboTerm' attribute of this SBML object.
|
java.util.Map<java.lang.String,java.lang.String> |
writeXMLAttributes() |
addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, fireNodeAddedEvent, firePropertyChange, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getTreeNodeChangeListenerCount, indexOf, isLeaf, isRoot, isSetParent, removeAllTreeNodeChangeListeners, removeTreeNodeChangeListener, removeTreeNodeChangeListener, setParent
finalize, getClass, notify, notifyAll, wait, wait, wait
removeTreeNodeChangeListener
addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, fireNodeAddedEvent, firePropertyChange, getListOfTreeNodeChangeListeners, getTreeNodeChangeListenerCount, isRoot, isSetParent, removeAllTreeNodeChangeListeners, removeTreeNodeChangeListener
private static final org.apache.log4j.Logger logger
private static final long serialVersionUID
private Annotation annotation
ValuePair<java.lang.Integer,java.lang.Integer> lv
private java.lang.String metaId
private java.util.SortedSet<java.lang.String> usedNamespaces
private java.util.Map<java.lang.String,java.lang.String> declaredNamespaces
private XMLNode notesXMLNode
private int sboTerm
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 is empty.
public AbstractSBase(int level, int version)
AbstractSBase
instance with the given Level and
Version.
By default, the sboTerm is -1, the metaid, notes,
AbstractTreeNode.parent
, annotation
, and notes are null. The
#setOfListeners
list is empty.
level
- the SBML levelversion
- the SBML versionpublic AbstractSBase(SBase sb)
sb
- an AbstractSBase
object to clonepublic static boolean isValidLevelAndVersionCombination(int level, int version)
level
- the SBML levelversion
- the SBML versionpublic boolean addCVTerm(CVTerm term)
public void addNamespace(java.lang.String namespace)
SBase
if the given namespace is not yet present within this
SortedSet
.addNamespace
in interface SBase
namespace
- the namespace to addpublic boolean removeNamespace(java.lang.String namespace)
namespace
- 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 appendNotes(java.lang.String notes)
SBase
appendNotes
in interface SBase
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 and returns a pointer to it.clone
in interface SBase
clone
in class AbstractTreeNode
public boolean equals(java.lang.Object object)
SBase
SBase
has exactly the same
properties like this SBase
instance.equals
in interface SBase
equals
in class AbstractTreeNode
Object
is an instance of
SBase
that has exactly the same properties like this
SBase instance.public java.util.List<CVTerm> filterCVTerms(CVTerm.Qualifier qualifier)
SBase
filterCVTerms
in interface SBase
public java.util.List<java.lang.String> filterCVTerms(CVTerm.Qualifier qualifier, java.lang.String pattern)
SBase
filterCVTerms
in interface SBase
pattern
- for instance, 'kegg' or 'chebi'.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 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()
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
.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 CVTerm getCVTerm(int index)
public java.util.List<CVTerm> getCVTerms()
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.lang.String getElementName()
getElementName
in interface SBase
public History getHistory()
getHistory
in interface SBase
History
instance of this object.private History createHistory()
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()
public java.util.SortedSet<java.lang.String> getNamespaces()
SBase
getNamespaces
in interface SBase
public java.util.Map<java.lang.String,java.lang.String> getDeclaredNamespaces()
SBase
getDeclaredNamespaces
in interface SBase
public XMLNode getNotes()
XMLNode
object that represent the notes of this element.public java.lang.String getNotesString()
getNotesString
in interface SBase
String
. If no
notes are set, an empty String
will be returned.public int getNumCVTerms()
getNumCVTerms
in interface SBase
CVTerm
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
getParentSBMLObject
in interface SBase
TreeNode.getParent()
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()
hashCode
in interface SBase
hashCode
in class AbstractTreeNode
Object.hashCode()
public boolean hasValidAnnotation()
hasValidAnnotation
in interface SBase
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 name space values correspond to a valid SBML
specification.hasValidLevelVersionNamespaceCombination
in interface SBase
public boolean isSetAnnotation()
SBase
isSetAnnotation
in interface SBase
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()
isSetHistory
in interface SBase
Annotation
instance of this objectpublic boolean isSetLevel()
isSetLevel
in interface SBase
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
isSetMetaId
in interface SBase
public boolean isSetNotes()
SBase
isSetNotes
in interface SBase
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 isSetSBOTerm()
isSetSBOTerm
in interface SBase
SBO
public boolean isSetVersion()
isSetVersion
in interface SBase
public boolean readAttribute(java.lang.String attributeName, java.lang.String prefix, java.lang.String value)
SBase
readAttribute
in interface SBase
attributeName
- : localName of the XML attributeprefix
- : prefix of the XML attributevalue
- : value of the XML attributepublic void registerChild(SBase sbase) throws LevelVersionError
SBase
Exception
is
thrown.registerChild
in interface SBase
LevelVersionError
public void unregister(SBase sbase)
SBase
Model
and SBMLDocument
.unregister
in interface SBase
public void setAnnotation(Annotation annotation)
SBase
Annotation
instance.setAnnotation
in interface SBase
public void setHistory(History history)
setHistory
in interface 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)public void setMetaId(java.lang.String metaId)
SBase
public void setNotes(java.lang.String notes)
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
setSBOTerm
in interface SBase
SBO
public void setSBOTerm(java.lang.String sboid)
SBase
setSBOTerm
in interface SBase
SBO
public void setThisAsParentSBMLObject(SBase sbase) throws LevelVersionError
SBase
Exception
is
thrown.setThisAsParentSBMLObject
in interface SBase
LevelVersionError
public void setVersion(int version)
SBase
Exception
is thrown.setVersion
in interface SBase
public abstract java.lang.String toString()
toString
in class AbstractTreeNode
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 unsetNotes()
SBase
unsetNotes
in interface SBase
public void unsetSBOTerm()
SBase
unsetSBOTerm
in interface SBase
public java.util.Map<java.lang.String,java.lang.String> writeXMLAttributes()
writeXMLAttributes
in interface SBase
Map
containing the XML attributes of this object.