T - The type of the wrapped data of the tree node.public class ListTreeModel<T> extends java.lang.Object implements TreeModel<T>
TreeModel which holds the tree children in a List.| Constructor and Description |
|---|
ListTreeModel() |
| Modifier and Type | Method and Description |
|---|---|
TreeModel<T> |
addChild(T data)
Creates and adds a child tree node with the given data to the current tree node and return it.
|
boolean |
equals(java.lang.Object object) |
int |
getChildCount()
Returns the count of the children of the current tree node.
|
java.util.List<TreeModel<T>> |
getChildren()
Returns an unmodifiable list of all child tree nodes of the current tree node.
|
T |
getData()
Returns the wrapped data of the current tree node.
|
java.lang.String |
getIndex()
Returns the zero-based unique index of the current tree node.
|
int |
getLevel()
Returns the level of the current tree node.
|
TreeModel<T> |
getParent()
Returns the parent tree node of the current tree node.
|
int |
hashCode() |
boolean |
isFirst()
Returns whether the current tree node is the first child of its parent, if any.
|
boolean |
isLast()
Returns whether the current tree node is the last child of its parent, if any.
|
boolean |
isLeaf()
Returns whether the current tree node is a leaf node.
|
boolean |
isRoot()
Returns whether the current tree node is the root node.
|
java.util.Iterator<TreeModel<T>> |
iterator()
Returns an unmodifiable iterator over the children of the current tree node.
|
void |
setData(T data)
Sets the wrapped data of the current tree node.
|
java.lang.String |
toString() |
public void setData(T data)
TreeModelpublic TreeModel<T> addChild(T data)
TreeModelpublic T getData()
TreeModelpublic TreeModel<T> getParent()
TreeModelpublic int getChildCount()
TreeModelgetChildCount in interface TreeModel<T>public java.util.List<TreeModel<T>> getChildren()
TreeModelTreeModel.addChild(Object) method. Adding/inserting/removing elements is not supported on the list.getChildren in interface TreeModel<T>public java.util.Iterator<TreeModel<T>> iterator()
TreeModelpublic int getLevel()
TreeModelpublic java.lang.String getIndex()
TreeModelnull. The first child has
index 0. The second child of first child has index 0_1. The first child of second child of
third child has index 2_1_0.public boolean isRoot()
TreeModelpublic boolean isLeaf()
TreeModelpublic boolean isFirst()
TreeModelpublic boolean isLast()
TreeModelpublic boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object