L
- The data type for the node objectpublic class Tree<L>
extends javax.swing.tree.DefaultMutableTreeNode
Modifier and Type | Method and Description |
---|---|
void |
add(L data)
Adds a child with the specified data to this tree.
|
boolean |
add(L data,
L parentData)
Adds the child with the specified data to the parent with the specified
data.
|
void |
add(javax.swing.tree.MutableTreeNode newChild)
Add a new child.
|
void |
add(Tree<L> newChild)
Adds a child to this tree
|
java.util.Iterator<L> |
breadthFirstIterator()
Breadth first iterator which iterates over the data elements within the
tree
|
java.util.Iterator<L> |
depthFirstIterator()
Depth first iterator which iterates over the data elements within the
tree
|
boolean |
equals(java.lang.Object obj)
Returns whether another Tree object equals this one.
|
Tree<L> |
findChild(L data)
Find a child tree with the specified data element.
|
java.util.ArrayList<L> |
getChildren()
Gets the list of child data elements
|
java.util.ArrayList<Tree<L>> |
getChildTrees()
Gets the list of child trees.
|
L |
getData()
Gets the typed data object associated with this tree node
|
int |
getLevel(L data)
Gets the level of the specified data element
|
int |
hashCode()
Get the hash code for this tree
|
java.util.Iterator<L> |
preOrderIterator()
Pre-order iterator which iterates over the data elements within the tree
|
int |
size()
Return the size of the tree.
|
breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
public Tree(L data)
data
- the data object for the treepublic void add(L data)
data
- the datapublic boolean add(L data, L parentData)
data
- the child dataparentData
- the parent datapublic void add(javax.swing.tree.MutableTreeNode newChild)
add
in class javax.swing.tree.DefaultMutableTreeNode
newChild
- the new childpublic java.util.Iterator<L> breadthFirstIterator()
public java.util.Iterator<L> depthFirstIterator()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare topublic Tree<L> findChild(L data)
data
- the data elementpublic java.util.ArrayList<L> getChildren()
public java.util.ArrayList<Tree<L>> getChildTrees()
public L getData()
public int getLevel(L data)
data
- the data elementpublic int hashCode()
hashCode
in class java.lang.Object
public java.util.Iterator<L> preOrderIterator()
public int size()