java.io.Serializable
, java.lang.Cloneable
, javax.swing.tree.TreeNode
, ASTNode2
, TreeNodeWithChangeSupport
public class ASTUnknown extends java.lang.Object implements ASTNode2
ASTNode2
with specified neutral behavior. Serves as a
stand-in for ASTNode2
when the empty constructor is called
in ASTNode
.
ASTUnknown
is a singleton and must be accessed through the
getInstance()
method.Modifier and Type | Method | Description |
---|---|---|
boolean |
addAllChangeListeners(java.util.Collection<TreeNodeChangeListener> listeners) |
Adds recursively all given
TreeNodeChangeListener instances to
this element. |
boolean |
addAllChangeListeners(java.util.Collection<TreeNodeChangeListener> listeners,
boolean recursive) |
|
void |
addTreeNodeChangeListener(TreeNodeChangeListener listener) |
Adds recursively a listener to the
TreeNodeWithChangeSupport
object and all of its sub-elements. |
void |
addTreeNodeChangeListener(TreeNodeChangeListener listener,
boolean recursive) |
Adds a listener to this
TreeNodeWithChangeSupport object and
optionally also to all of its child nodes. |
java.util.Enumeration<? extends javax.swing.tree.TreeNode> |
children() |
|
void |
clearUserObjects() |
Removes all of the mappings from the map of user objects (optional
operation).
|
ASTNode2 |
clone() |
Clone ASTNode2
|
ASTNode2Value<?> |
compile(ASTNode2Compiler compiler) |
Compiles this
ASTNode2 and returns the result. |
boolean |
containsUserObjectKey(java.lang.Object key) |
|
java.util.List<? extends javax.swing.tree.TreeNode> |
filter(Filter filter) |
Filters this tree data structure recursively and returns a list of all
TreeNode s that are accepted by the Filter . |
java.util.List<? extends javax.swing.tree.TreeNode> |
filter(Filter filter,
boolean retainInternalNodes) |
Filters this tree data structure recursively and returns a list of all
TreeNode s that are accepted by the Filter . |
java.util.List<? extends javax.swing.tree.TreeNode> |
filter(Filter filter,
boolean retainInternalNodes,
boolean prune) |
Filters this tree data structure recursively and returns a list of all
TreeNode s that are accepted by the Filter . |
void |
fireNodeAddedEvent() |
All
TreeNodeChangeListener instances linked to this
TreeNode are informed about the adding of this Object to
an owning parent Object . |
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() |
|
javax.swing.tree.TreeNode |
getChildAt(int childIndex) |
|
int |
getChildCount() |
|
java.lang.String |
getId() |
Get the id of this node
|
int |
getIndex(javax.swing.tree.TreeNode node) |
|
static ASTUnknown |
getInstance() |
|
java.util.List<TreeNodeChangeListener> |
getListOfTreeNodeChangeListeners() |
Returns all
TreeNodeChangeListener s that are assigned to this
element. |
java.lang.String |
getMathMLClass() |
Returns the class of the MathML element represented by
this
ASTNode2 |
javax.swing.tree.TreeNode |
getParent() |
|
MathContainer |
getParentSBMLObject() |
Return the parentSBMLObject of this
ASTNode2 |
javax.swing.tree.TreeNode |
getRoot() |
|
java.lang.String |
getStyle() |
Return the style of this node
|
int |
getTreeNodeChangeListenerCount() |
|
ASTNode.Type |
getType() |
Returns the type of this ASTNode2.
|
java.lang.Object |
getUserObject(java.lang.Object key) |
|
boolean |
isAllowableType(ASTNode.Type type) |
Returns
true iff type is allowed in this ASTNode2 |
boolean |
isLeaf() |
|
boolean |
isRoot() |
Opposite of
TreeNodeWithChangeSupport.isSetParent() . |
boolean |
isSetId() |
Returns true iff id has been set
|
boolean |
isSetMathMLClass() |
Returns true iff mathMLClass has been set
|
boolean |
isSetParent() |
|
boolean |
isSetParentSBMLObject() |
Checks if a parent SBML object, i.e., a
MathContainer , is set as a
parent SBML object for this ASTNode2 . |
boolean |
isSetStyle() |
Returns true iff style has been set
|
boolean |
isSetType() |
Returns true iff type has been set
|
boolean |
isSetUserObjects() |
Checks whether any user-defined key-value pairs have been attached
to this object.
|
boolean |
isStrict() |
Specifies strictness.
|
void |
putUserObject(java.lang.Object key,
java.lang.Object userObject) |
|
void |
removeAllTreeNodeChangeListeners() |
Removes all tree node change listeners from this element.
|
void |
removeAllTreeNodeChangeListeners(boolean recursive) |
Removes all tree node change listeners recursively from this element.
|
boolean |
removeFromParent() |
Removes itself from its parent.
|
void |
removeTreeNodeChangeListener(TreeNodeChangeListener listener) |
Removes recursively the given change listener from this element.
|
void |
removeTreeNodeChangeListener(TreeNodeChangeListener listener,
boolean recursive) |
Removes the given change listener from this element.
|
java.lang.Object |
removeUserObject(java.lang.Object key) |
|
void |
setId(java.lang.String id) |
Set the id of this node
|
void |
setMathMLClass(java.lang.String mathMLClass) |
Set the class of the MathML element represented by
this
ASTNode2 |
void |
setParent(javax.swing.tree.TreeNode astNode2) |
|
void |
setParentSBMLObject(MathContainer container) |
Sets the parentSBMLObject to container recursively
|
void |
setStrictness(boolean strict) |
Set the strictness of this node
|
void |
setStyle(java.lang.String style) |
Set the style of this node
|
void |
setType(java.lang.String typeStr) |
Sets the type from a String.
|
void |
setType(ASTNode.Type type) |
Set the type of the MathML element represented by this
ASTNode2 |
java.lang.String |
toFormula() |
Converts this
ASTNode2 to a text string using a specific syntax
for mathematical formulas. |
java.lang.String |
toLaTeX() |
Converts this node recursively into a LaTeX formatted String.
|
java.lang.String |
toMathML() |
Converts this node recursively into a MathML string that corresponds to
the subset of MathML defined in the SBML specification.
|
java.lang.String |
toString() |
|
void |
unsetParentSBMLObject() |
Unsets the parentSBMLObject to
null recursively. |
java.util.Set<java.lang.Object> |
userObjectKeySet() |
public static ASTUnknown getInstance()
public boolean addAllChangeListeners(java.util.Collection<TreeNodeChangeListener> listeners)
TreeNodeWithChangeSupport
TreeNodeChangeListener
instances to
this element.addAllChangeListeners
in interface TreeNodeWithChangeSupport
listeners
- the set of listeners to addtrue
if the set of listeners is added with success.public void addTreeNodeChangeListener(TreeNodeChangeListener listener)
TreeNodeWithChangeSupport
TreeNodeWithChangeSupport
object and all of its sub-elements. Calling this method is effectively
identical to the call
TreeNodeWithChangeSupport.addTreeNodeChangeListener(TreeNodeChangeListener, boolean)
where
recursively = true
.addTreeNodeChangeListener
in interface TreeNodeWithChangeSupport
listener
- the listener to addTreeNodeWithChangeSupport.addTreeNodeChangeListener(TreeNodeChangeListener, boolean)
public void addTreeNodeChangeListener(TreeNodeChangeListener listener, boolean recursive)
TreeNodeWithChangeSupport
TreeNodeWithChangeSupport
object and
optionally also to all of its child nodes.addTreeNodeChangeListener
in interface TreeNodeWithChangeSupport
listener
- the listener to addrecursive
- if true
the given listener will be added to this node and
also recursively to all of its child nodes. If false
, the
listener will only be added to the current node.TreeNodeWithChangeSupport.addTreeNodeChangeListener(TreeNodeChangeListener)
public java.util.Enumeration<? extends javax.swing.tree.TreeNode> children()
children
in interface javax.swing.tree.TreeNode
public void clearUserObjects()
TreeNodeWithChangeSupport
clearUserObjects
in interface TreeNodeWithChangeSupport
Map#clear()
public ASTNode2Value<?> compile(ASTNode2Compiler compiler)
ASTNode2
ASTNode2
and returns the result.compile
in interface ASTNode2
compiler
- An instance of an ASTNode2Compiler
that provides
methods to translate this ASTNode2
into something
different.ASTNode2Value
. The content of the
wrapper depends on the ASTNode2Compiler
used to create it.
However, this ASTNode2
will ensure that level and version
are set appropriately according to this node's parent SBML
object.public boolean containsUserObjectKey(java.lang.Object key)
containsUserObjectKey
in interface TreeNodeWithChangeSupport
Map#containsKey(java.lang.Object)
public java.util.List<? extends javax.swing.tree.TreeNode> filter(Filter filter)
TreeNodeWithChangeSupport
TreeNode
s that are accepted by the Filter
. Although
internal nodes that do not satisfy the filter criterion by themselves
are not contained in the resulting list, the recursion continues at
their children.filter
in interface TreeNodeWithChangeSupport
filter
- A criterion to select a sub-set of nodes of this tree.List
of TreeNode
s that do all satisfy the
criterion of the given Filter
.TreeNodeWithChangeSupport.filter(Filter, boolean)
public java.util.List<? extends javax.swing.tree.TreeNode> filter(Filter filter, boolean retainInternalNodes)
TreeNodeWithChangeSupport
TreeNode
s that are accepted by the Filter
. The second
argument decides whether or not internal nodes that do not by themselves
satisfy the filter criterion should still be retained in the result list.filter
in interface TreeNodeWithChangeSupport
filter
- A criterion to select a sub-set of nodes of this tree.retainInternalNodes
- Decides if internal nodes should also be included in the
resulting List
if they do not by themselves satisfy
the Filter
but if these do have child elements that do
so. This might be useful in order to obtain a complete tree
path to interesting sub-elements.List
representing a subset of TreeNode
s that
satisfy the Filter
's criterion, or whose child nodes do
so.TreeNodeWithChangeSupport.filter(Filter)
public java.util.List<? extends javax.swing.tree.TreeNode> filter(Filter filter, boolean retainInternalNodes, boolean prune)
TreeNodeWithChangeSupport
TreeNode
s that are accepted by the Filter
. The two
boolean switches let you decide if internal nodes that do not by
themselves satisfy the filter criterion should be retained in the list,
and if the recursion should be aborted as soon as the first hit is
discovered.filter
in interface TreeNodeWithChangeSupport
retainInternalNodes
- decides whether or not internal nodes should be added to the
list of results even though these might not by themselves
satisfy the filter's criterion, but whose children do. This
feature can be useful, e.g., in order to keep the full tree
path to nodes of interestprune
- if this argument is true
, the recursive search is
aborted upon the discovery of the first hit.List
representing a subset of TreeNode
s that
satisfy the Filter
's criterion, or whose child nodes do
so.TreeNodeWithChangeSupport.filter(Filter, boolean)
public void fireNodeAddedEvent()
TreeNodeWithChangeSupport
TreeNodeChangeListener
instances linked to this
TreeNode
are informed about the adding of this Object
to
an owning parent Object
.fireNodeAddedEvent
in interface TreeNodeWithChangeSupport
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
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
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 boolean getAllowsChildren()
getAllowsChildren
in interface javax.swing.tree.TreeNode
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 java.lang.String getId()
ASTNode2
public int getIndex(javax.swing.tree.TreeNode node)
getIndex
in interface javax.swing.tree.TreeNode
public java.util.List<TreeNodeChangeListener> getListOfTreeNodeChangeListeners()
TreeNodeWithChangeSupport
TreeNodeChangeListener
s that are assigned to this
element.getListOfTreeNodeChangeListeners
in interface TreeNodeWithChangeSupport
TreeNodeChangeListener
s that are assigned to this
element.public java.lang.String getMathMLClass()
ASTNode2
ASTNode2
getMathMLClass
in interface ASTNode2
public javax.swing.tree.TreeNode getParent()
getParent
in interface javax.swing.tree.TreeNode
public MathContainer getParentSBMLObject()
ASTNode2
ASTNode2
getParentSBMLObject
in interface ASTNode2
public javax.swing.tree.TreeNode getRoot()
getRoot
in interface TreeNodeWithChangeSupport
TreeNode
without parent, which is the top-most ancestor
of this node.public java.lang.String getStyle()
ASTNode2
public int getTreeNodeChangeListenerCount()
getTreeNodeChangeListenerCount
in interface TreeNodeWithChangeSupport
TreeNodeChangeListener
s currently assigned to
this TreeNodeWithChangeSupport
public ASTNode.Type getType()
ASTNode2
public java.lang.Object getUserObject(java.lang.Object key)
getUserObject
in interface TreeNodeWithChangeSupport
public boolean isAllowableType(ASTNode.Type type)
ASTNode2
true
iff type is allowed in this ASTNode2
isAllowableType
in interface ASTNode2
public boolean isLeaf()
isLeaf
in interface javax.swing.tree.TreeNode
public boolean isRoot()
TreeNodeWithChangeSupport
TreeNodeWithChangeSupport.isSetParent()
.
Returns true
if this AbstractTreeNode
is the root
node of a tree, false
otherwise.isRoot
in interface TreeNodeWithChangeSupport
true
if this AbstractTreeNode
is the root
node of a tree, false
otherwise.TreeNodeWithChangeSupport.isSetParent()
public boolean isSetId()
ASTNode2
public boolean isSetMathMLClass()
ASTNode2
isSetMathMLClass
in interface ASTNode2
public boolean isSetParent()
isSetParent
in interface TreeNodeWithChangeSupport
public boolean isSetParentSBMLObject()
ASTNode2
MathContainer
, is set as a
parent SBML object for this ASTNode2
.isSetParentSBMLObject
in interface ASTNode2
public boolean isSetStyle()
ASTNode2
isSetStyle
in interface ASTNode2
public boolean isSetType()
ASTNode2
public boolean isSetUserObjects()
TreeNodeWithChangeSupport
isSetUserObjects
in interface TreeNodeWithChangeSupport
true
if at least one user-defined key-value pair has
been attached to this object.public boolean isStrict()
ASTNode2
public void putUserObject(java.lang.Object key, java.lang.Object userObject)
putUserObject
in interface TreeNodeWithChangeSupport
key
- some user-defined key under which the given userObject can be
found.userObject
- the userObject to setpublic void removeAllTreeNodeChangeListeners()
TreeNodeWithChangeSupport
removeAllTreeNodeChangeListeners
in interface TreeNodeWithChangeSupport
public boolean removeFromParent()
TreeNodeWithChangeSupport
List
, it is simply cleared.
Will fail (and not delete itself) if it has no parent object. This function
will work for all objects whose parent is of type List
and most
instances of TreeNode
.removeFromParent
in interface TreeNodeWithChangeSupport
false
if this element is a root node, true
otherwise.public void removeTreeNodeChangeListener(TreeNodeChangeListener listener)
TreeNodeWithChangeSupport
TreeNodeWithChangeSupport.removeTreeNodeChangeListener(TreeNodeChangeListener, boolean)
where the second argument is true
.removeTreeNodeChangeListener
in interface TreeNodeWithChangeSupport
listener
- the listener to remove.TreeNodeWithChangeSupport.removeTreeNodeChangeListener(TreeNodeChangeListener, boolean)
public void removeTreeNodeChangeListener(TreeNodeChangeListener listener, boolean recursive)
TreeNodeWithChangeSupport
removeTreeNodeChangeListener
in interface TreeNodeWithChangeSupport
listener
- the listener to remove.recursive
- switch to decide whether or not the given listener should be removed
in a recursive manner.TreeNodeWithChangeSupport.removeTreeNodeChangeListener(TreeNodeChangeListener)
public java.lang.Object removeUserObject(java.lang.Object key)
removeUserObject
in interface TreeNodeWithChangeSupport
public void setId(java.lang.String id)
ASTNode2
public void setMathMLClass(java.lang.String mathMLClass)
ASTNode2
ASTNode2
setMathMLClass
in interface ASTNode2
public void setParent(javax.swing.tree.TreeNode astNode2)
public void setParentSBMLObject(MathContainer container)
ASTNode2
setParentSBMLObject
in interface ASTNode2
public void setStrictness(boolean strict)
ASTNode2
setStrictness
in interface ASTNode2
public void setStyle(java.lang.String style)
ASTNode2
public void setType(java.lang.String typeStr)
ASTNode2
public void setType(ASTNode.Type type)
ASTNode2
ASTNode2
public java.lang.String toFormula()
ASTNode2
Converts this ASTNode2
to a text string using a specific syntax
for mathematical formulas.
The text-string form of mathematical formulas produced by formulaToString() and read by parseFormula() are simple C-inspired infix notation taken from SBML Level 1. A formula in this text-string form therefore can be handed to a program that understands SBML Level 1 mathematical expressions, or used as part of a formula translation system. The syntax is described in detail in the documentation for ASTNode.
public java.lang.String toLaTeX()
ASTNode2
public java.lang.String toMathML()
ASTNode2
public void unsetParentSBMLObject()
ASTNode2
null
recursively.unsetParentSBMLObject
in interface ASTNode2
public java.util.Set<java.lang.Object> userObjectKeySet()
userObjectKeySet
in interface TreeNodeWithChangeSupport
Map#keySet()
public java.lang.String toString()
public void removeAllTreeNodeChangeListeners(boolean recursive)
TreeNodeWithChangeSupport
removeAllTreeNodeChangeListeners
in interface TreeNodeWithChangeSupport
public boolean addAllChangeListeners(java.util.Collection<TreeNodeChangeListener> listeners, boolean recursive)
addAllChangeListeners
in interface TreeNodeWithChangeSupport