java.io.Serializable
, java.lang.Cloneable
, javax.swing.tree.TreeNode
, ASTNode2
, TreeNodeWithChangeSupport
ASTCSymbolDelayNode
, ASTDivideNode
, ASTLogarithmNode
, ASTMinusNode
, ASTPlusNode
, ASTPowerNode
, ASTRootNode
, ASTTimesNode
public class ASTBinaryFunctionNode extends ASTFunction
Constructor | Description |
---|---|
ASTBinaryFunctionNode() |
Creates a new
ASTBinaryFunctionNode . |
ASTBinaryFunctionNode(ASTBinaryFunctionNode node) |
Copy constructor; Creates a deep copy of the given
ASTBinaryFunctionNode . |
ASTBinaryFunctionNode(ASTNode2 leftChild,
ASTNode2 rightChild) |
Creates a new
ASTBinaryFunctionNode with the specified
children. |
Modifier and Type | Method | Description |
---|---|---|
void |
addChild(ASTNode2 child) |
Adds a child to this node.
|
ASTBinaryFunctionNode |
clone() |
Clone ASTNode2
|
ASTNode2 |
getChildAt(int childIndex) |
|
ASTNode2 |
getLeftChild() |
Get the left child of this
ASTBinaryFunctionNode |
ASTNode2 |
getRightChild() |
Get the right child of this
ASTBinaryFunctionNode |
void |
insertChild(int n,
ASTNode2 newChild) |
|
boolean |
isSetLeftChild() |
Return true iff left child has been set
|
boolean |
isSetRightChild() |
Return true iff right child has been set
|
void |
prependChild(ASTNode2 child) |
Adds the given node as a child of this
ASTBinaryFunctionNode . |
boolean |
removeChild(int n) |
Removes child n of this
ASTFunction . |
void |
setLeftChild(ASTNode2 child) |
Set the left child of this
ASTBinaryFunctionNode |
void |
setRightChild(ASTNode2 child) |
Set the right child of this
ASTBinaryFunctionNode |
void |
swapChildren(ASTFunction that) |
Swaps the children of this
ASTFunction with the children of that
ASTFunction . |
getId, getMathMLClass, getParentSBMLObject, getStyle, getType, isSetId, isSetMathMLClass, isSetParentSBMLObject, isSetStyle, isSetType, isStrict, setId, setMathMLClass, setParent, setStrictness, setStyle, setType, setType, toFormula, toLaTeX, toMathML, unsetParentSBMLObject
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, fireNodeRemovedEvent, firePropertyChange, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getParent, getRoot, getTreeNodeChangeListenerCount, getUserObject, indexOf, isLeaf, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, toString, userObjectKeySet
compile, equals, findReferencedCallableSBases, getAllowsChildren, getChildCount, getChildren, getListOfNodes, getListOfNodes, getName, hashCode, hasUnits, isAllowableType, isSetName, replaceChild, setName, setParentSBMLObject
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, fireNodeRemovedEvent, firePropertyChange, getListOfTreeNodeChangeListeners, getRoot, getTreeNodeChangeListenerCount, getUserObject, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, userObjectKeySet
public ASTBinaryFunctionNode()
ASTBinaryFunctionNode
.public ASTBinaryFunctionNode(ASTBinaryFunctionNode node)
ASTBinaryFunctionNode
.node
- the ASTBinaryFunctionNode
to be copied.public ASTBinaryFunctionNode(ASTNode2 leftChild, ASTNode2 rightChild)
ASTBinaryFunctionNode
with the specified
children.leftChild
- rightChild
- public void addChild(ASTNode2 child)
addChild
in class ASTFunction
child
- the node to add as child.java.lang.NullPointerException
- if the child is nulljava.lang.IndexOutOfBoundsException
- if strictness is set to true
and max child limit has been exceededpublic ASTBinaryFunctionNode clone()
ASTNode2
clone
in interface ASTNode2
clone
in class ASTFunction
public ASTNode2 getChildAt(int childIndex)
getChildAt
in interface javax.swing.tree.TreeNode
getChildAt
in class ASTFunction
java.lang.IndexOutOfBoundsException
- if strictness is set to true
and max child limit has been exceededpublic ASTNode2 getLeftChild()
ASTBinaryFunctionNode
ASTNode2
leftChildpublic ASTNode2 getRightChild()
ASTBinaryFunctionNode
ASTNode2
rightChildpublic void insertChild(int n, ASTNode2 newChild)
ASTNode2
at point n in the list of children of this
ASTNode2
. Inserting a child within an ASTNode2
may result in an inaccurate
representation.insertChild
in class ASTFunction
n
- long the index of the ASTNode2
being addednewChild
- ASTNode2
to insert as the nth childjava.lang.NullPointerException
- if the child is nulljava.lang.IndexOutOfBoundsException
- if strictness is set to true
and max child limit has been exceededpublic boolean isSetLeftChild()
public boolean isSetRightChild()
public void prependChild(ASTNode2 child)
ASTBinaryFunctionNode
.
This method adds child nodes from right to left.prependChild
in class ASTFunction
child
- an ASTNode2
java.lang.NullPointerException
- if the child is nulljava.lang.IndexOutOfBoundsException
- if strictness is set to true
and max child limit has been exceededpublic boolean removeChild(int n)
ASTFunction
ASTFunction
. Removing a child from an
ASTFunction
may result in an inaccurate representation.removeChild
in class ASTFunction
n
- the index of the child to removepublic void setLeftChild(ASTNode2 child)
ASTBinaryFunctionNode
child
- ASTNode2
public void setRightChild(ASTNode2 child)
ASTBinaryFunctionNode
child
- ASTNode2
public void swapChildren(ASTFunction that)
Swaps the children of this ASTFunction
with the children of that
ASTFunction
.
Unfortunately, when swapping child nodes, we have to recursively traverse the entire subtrees in order to make sure that all pointers to the parent SBML object are correct. However, this must only be done if the parent SBML object of that differs from the one surrounding this node.
In any case, the pointer from each sub-node to its parent must be changed.
In contrast to other SBML elements, ASTFunction
s have sub-nodes as
direct children, i.e., there is no child called 'ListOfNodes'. The
setParent
method is also not recursive.
However, this might cause many calls to listeners.
swapChildren
in class ASTFunction
that
- the other node whose children should be used to replace this
node's childrenjava.lang.IndexOutOfBoundsException
- if strictness is set to true
and max child limit has been exceeded