Package cz.vutbr.fit.layout.model
Interface GenericTreeNode<T extends GenericTreeNode<T>>
-
- All Known Subinterfaces:
Area,Box,LogicalArea
- All Known Implementing Classes:
DefaultArea,DefaultBox,DefaultLogicalArea,DefaultTreeContentRect,DefaultTreeNode
public interface GenericTreeNode<T extends GenericTreeNode<T>>A generic tree node interface.- Author:
- burgetr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidappendChild(T child)voidappendChildren(List<T> children)List<T>findNodesPostOrder(Predicate<T> predicate)Traverses the tree rooted in this node postorder and finds all nodes by a predicate.List<T>findNodesPreOrder(Predicate<T> predicate)Traverses the tree rooted in this node preorder and finds all nodes by a predicate.intgetDepth()TgetChildAt(int index)intgetChildCount()List<T>getChildren()intgetIndex(T child)intgetLeafCount()TgetNextSibling()TgetParent()TgetPreviousSibling()TgetRoot()voidchildrenChanged()Signals that some children have been added or removed or their state changed.voidinsertChild(T child, int index)booleanisLeaf()booleanisRoot()voidremoveAllChildren()voidremoveChild(int index)voidremoveChild(T child)voidsetParent(T parent)voidsetRoot(T root)
-
-
-
Method Detail
-
getParent
T getParent()
-
setParent
void setParent(T parent)
-
getRoot
T getRoot()
-
setRoot
void setRoot(T root)
-
isRoot
boolean isRoot()
-
getChildCount
int getChildCount()
-
isLeaf
boolean isLeaf()
-
appendChild
void appendChild(T child)
-
insertChild
void insertChild(T child, int index) throws IndexOutOfBoundsException
- Throws:
IndexOutOfBoundsException
-
removeAllChildren
void removeAllChildren()
-
removeChild
void removeChild(int index) throws IndexOutOfBoundsException- Throws:
IndexOutOfBoundsException
-
removeChild
void removeChild(T child) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
getChildAt
T getChildAt(int index) throws IndexOutOfBoundsException
- Throws:
IndexOutOfBoundsException
-
getIndex
int getIndex(T child)
-
getPreviousSibling
T getPreviousSibling()
-
getNextSibling
T getNextSibling()
-
getDepth
int getDepth()
-
getLeafCount
int getLeafCount()
-
findNodesPreOrder
List<T> findNodesPreOrder(Predicate<T> predicate)
Traverses the tree rooted in this node preorder and finds all nodes by a predicate.- Parameters:
predicate- The predicate to test ornullwhen all nodes should be returned.- Returns:
- The list of nodes found.
-
findNodesPostOrder
List<T> findNodesPostOrder(Predicate<T> predicate)
Traverses the tree rooted in this node postorder and finds all nodes by a predicate.- Parameters:
predicate- The predicate to test ornullwhen all nodes should be returned.- Returns:
- The list of nodes found.
-
childrenChanged
void childrenChanged()
Signals that some children have been added or removed or their state changed.
-
-