Package com.macrofocus.hierarchy
Interface Hierarchy<T>
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
MutableHierarchy<T>
- All Known Implementing Classes:
AbstractHierarchy,SimpleHierarchy
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddHierarchyListener(HierarchyListener<T> listener) voidaddWeakHierarchyListener(HierarchyListener<T> listener) breadthFirstIterator(T parent) Creates and returns an iterable that traverses the subhierarchy rooted at the give node in breadth-first order.booleancontainsChild(T child) booleancontainsChild(T parent, T child) depthFirstIterator(T parent) Creates and returns an iterable that traverses the subhierarchy rooted at the give node in depth-first order.intgetChildCount(T parent) getChildList(T parent) getChildren(T parent) intgetDepth()getFirstLeaf(T node) intgetIndexOfChild(T parent, T child) getLastLeaf(T node) intgetLeafCount(T node) intgetNextLeaf(T node) Returns the path from the root, to get to this node.Object[]getPathToRoot(T child) getPreviousLeaf(T node) getRoot()booleanbooleanbooleanleavesIterator(T parent) voidnotifyHierarchyNodeChanged(T child, T parent, int index, boolean isAdjusting) preorderIterator(T parent) Creates and returns an iterable that traverses the subhierarchy rooted at the give node in preorder.voidremoveHierarchyListener(HierarchyListener<T> listener) voidvoidsetNotifyListeners(boolean enable)
-
Method Details
-
getRoot
T getRoot() -
isRoot
-
getParent
-
hasChild
-
getChildren
-
getChildList
-
getChild
-
getChildCount
-
getIndexOfChild
-
containsChild
-
containsChild
-
preorderIterator
-
breadthFirstIterator
-
depthFirstIterator
-
leavesIterator
-
preorderIterator
Creates and returns an iterable that traverses the subhierarchy rooted at the give node in preorder. The first node returned by the iterator's next() method is the given node.- Parameters:
parent- the root of the hierarchy to traverse- Returns:
- an iterable that traverses the subtree rooted at this node in preorder.
-
breadthFirstIterator
Creates and returns an iterable that traverses the subhierarchy rooted at the give node in breadth-first order. The first node returned by the iterator's next() method is the given node.- Parameters:
parent- the root of the hierarchy to traverse- Returns:
- an iterable that traverses the subtree rooted at this node in breadth-first order.
-
depthFirstIterator
Creates and returns an iterable that traverses the subhierarchy rooted at the give node in depth-first order. The first node returned by the iterator's next() method is the leftmost leaf.- Parameters:
parent- the root of the hierarchy to traverse- Returns:
- an iterable that traverses the subtree rooted at this node in depth-first order.
-
leavesIterator
-
addHierarchyListener
-
addWeakHierarchyListener
-
removeHierarchyListener
-
removeHierarchyListeners
void removeHierarchyListeners() -
setNotifyListeners
void setNotifyListeners(boolean enable) -
getListeners
Iterable<HierarchyListener<T>> getListeners() -
getPath
Returns the path from the root, to get to this node. The last element in the path is this node.- Returns:
- an array of objects giving the path, where the first element in the path is the root and the last element is this node.
-
getPathToRoot
-
notifyHierarchyNodeChanged
-
getDepth
int getDepth() -
getLevel
-
isLeaf
-
getLeafCount
-
getFirstLeaf
-
getLastLeaf
-
getNextLeaf
-
getPreviousLeaf
-