# Interface Hierarchy<T>

All Superinterfaces:
  `Serializable`

All Known Subinterfaces:
  `MutableHierarchy<T>`

All Known Implementing Classes:
  `AbstractHierarchy, SimpleHierarchy`

public interface Hierarchy<T> extends Serializable

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addHierarchyListener(HierarchyListener<T> listener)`
  `void`
  `addWeakHierarchyListener(HierarchyListener<T> listener)`
  `Iterable<T>`
  `breadthFirstIterator()`
  `Iterable<T>`
  `breadthFirstIterator(T parent)`
  Creates and returns an iterable that traverses the subhierarchy rooted at the give node in breadth-first order.
  `boolean`
  `containsChild(T child)`
  `boolean`
  `containsChild(T parent, T child)`
  `Iterable<T>`
  `depthFirstIterator()`
  `Iterable<T>`
  `depthFirstIterator(T parent)`
  Creates and returns an iterable that traverses the subhierarchy rooted at the give node in depth-first order.
  `T`
  `getChild(T parent, int index)`
  `int`
  `getChildCount(T parent)`
  `List<T>`
  `getChildList(T parent)`
  `Iterable<T>`
  `getChildren(T parent)`
  `int`
  `getDepth()`
  `T`
  `getFirstLeaf(T node)`
  `int`
  `getIndexOfChild(T parent, T child)`
  `T`
  `getLastLeaf(T node)`
  `int`
  `getLeafCount(T node)`
  `int`
  `getLevel(T node)`
  `Iterable<HierarchyListener<T>>`
  `getListeners()`
  `T`
  `getNextLeaf(T node)`
  `T`
  `getParent(T child)`
  `List<T>`
  `getPath(T node)`
  Returns the path from the root, to get to this node.
  `Object[]`
  `getPathToRoot(T child)`
  `T`
  `getPreviousLeaf(T node)`
  `T`
  `getRoot()`
  `boolean`
  `hasChild(T parent)`
  `boolean`
  `isLeaf(T node)`
  `boolean`
  `isRoot(T node)`
  `Iterable<T>`
  `leavesIterator()`
  `Iterable<T>`
  `leavesIterator(T parent)`
  `void`
  `notifyHierarchyNodeChanged(T child, T parent, int index, boolean isAdjusting)`
  `Iterable<T>`
  `preorderIterator()`
  `Iterable<T>`
  `preorderIterator(T parent)`
  Creates and returns an iterable that traverses the subhierarchy rooted at the give node in preorder.
  `void`
  `removeHierarchyListener(HierarchyListener<T> listener)`
  `void`
  `removeHierarchyListeners()`
  `void`
  `setNotifyListeners(boolean enable)`

- ## Method Details

  - ### getRoot

    T getRoot()

  - ### isRoot

    boolean isRoot(T node)

  - ### getParent

    T getParent(T child)

  - ### hasChild

    boolean hasChild(T parent)

  - ### getChildren

    Iterable<T> getChildren(T parent)

  - ### getChildList

    List<T> getChildList(T parent)

  - ### getChild

    T getChild(T parent, int index)

  - ### getChildCount

    int getChildCount(T parent)

  - ### getIndexOfChild

    int getIndexOfChild(T parent, T child)

  - ### containsChild

    boolean containsChild(T parent, T child)

  - ### containsChild

    boolean containsChild(T child)

  - ### preorderIterator

    Iterable<T> preorderIterator()

  - ### breadthFirstIterator

    Iterable<T> breadthFirstIterator()

  - ### depthFirstIterator

    Iterable<T> depthFirstIterator()

  - ### leavesIterator

    Iterable<T> leavesIterator()

  - ### preorderIterator

    Iterable<T> preorderIterator(T parent)
    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

    Iterable<T> breadthFirstIterator(T parent)
    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

    Iterable<T> depthFirstIterator(T parent)
    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

    Iterable<T> leavesIterator(T parent)

  - ### addHierarchyListener

    void addHierarchyListener(HierarchyListener<T> listener)

  - ### addWeakHierarchyListener

    void addWeakHierarchyListener(HierarchyListener<T> listener)

  - ### removeHierarchyListener

    void removeHierarchyListener(HierarchyListener<T> listener)

  - ### removeHierarchyListeners

    void removeHierarchyListeners()

  - ### setNotifyListeners

    void setNotifyListeners(boolean enable)

  - ### getListeners

    Iterable<HierarchyListener<T>> getListeners()

  - ### getPath

    List<T> getPath(T node)
    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

    Object[] getPathToRoot(T child)

  - ### notifyHierarchyNodeChanged

    void notifyHierarchyNodeChanged(T child, T parent, int index, boolean isAdjusting)

  - ### getDepth

    int getDepth()

  - ### getLevel

    int getLevel(T node)

  - ### isLeaf

    boolean isLeaf(T node)

  - ### getLeafCount

    int getLeafCount(T node)

  - ### getFirstLeaf

    T getFirstLeaf(T node)

  - ### getLastLeaf

    T getLastLeaf(T node)

  - ### getNextLeaf

    T getNextLeaf(T node)

  - ### getPreviousLeaf

    T getPreviousLeaf(T node)