# Class SimpleHierarchy<T>

java.lang.Object
com.macrofocus.hierarchy.AbstractHierarchy<T>
com.macrofocus.hierarchy.SimpleHierarchy<T>

All Implemented Interfaces:
  `Hierarchy<T>, MutableHierarchy<T>, Serializable, Cloneable`

public class SimpleHierarchy<T> extends AbstractHierarchy<T> implements MutableHierarchy<T>, Cloneable
A simple mutable hierarchy implementation.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SimpleHierarchy(Hierarchy<T> hierarchy)`
  `SimpleHierarchy(T root)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `T`
  `addChild(T parent, T child)`
  `void`
  `addChildren(T parent, List<T> children)`
  `boolean`
  `containsChild(T child)`
  `boolean`
  `containsChild(T parent, T child)`
  `T`
  `getChild(T parent, int index)`
  `int`
  `getChildCount(T parent)`
  `List<T>`
  `getChildList(T parent)`
  `Iterable<T>`
  `getChildren(T parent)`
  `int`
  `getIndexOfChild(T parent, T child)`
  `T`
  `getParent(T child)`
  `T`
  `getRoot()`
  `boolean`
  `hasChild(T parent)`
  `void`
  `insertChild(T parent, int index, T child)`
  `void`
  `moveChild(T oldParent, T newParent, int insertionPoint, T child)`
  `void`
  `removeAll()`
  `void`
  `removeChild(T parent, T child)`
  `void`
  `removeChildren(List<T> children)`
  `void`
  `setChildren(T parent, List<T> children)`

  ### Methods inherited from class AbstractHierarchy

  `addHierarchyListener, addWeakHierarchyListener, breadthFirstIterator, breadthFirstIterator, depthFirstIterator, depthFirstIterator, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getLeafCount, getLevel, getListeners, getNextLeaf, getNextSibling, getPath, getPathToRoot, getPathToRoot, getPreviousLeaf, getPreviousSibling, isAncestor, isLeaf, isNodeChild, isNodeSibling, isRoot, leavesIterator, leavesIterator, notifyHierarchyNodeChanged, notifyHierarchyNodeInserted, notifyHierarchyNodeRemoved, notifyHierarchyStructureChanged, preorderIterator, preorderIterator, removeHierarchyListener, removeHierarchyListeners, setNotifyListeners, toString`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface Hierarchy

  `addHierarchyListener, addWeakHierarchyListener, breadthFirstIterator, breadthFirstIterator, depthFirstIterator, depthFirstIterator, getDepth, getFirstLeaf, getLastLeaf, getLeafCount, getLevel, getListeners, getNextLeaf, getPath, getPathToRoot, getPreviousLeaf, isLeaf, isRoot, leavesIterator, leavesIterator, notifyHierarchyNodeChanged, preorderIterator, preorderIterator, removeHierarchyListener, removeHierarchyListeners, setNotifyListeners`

- ## Constructor Details

  - ### SimpleHierarchy

    public SimpleHierarchy(Hierarchy<T> hierarchy)

  - ### SimpleHierarchy

    public SimpleHierarchy(T root)

- ## Method Details

  - ### getRoot

    public T getRoot()
    Specified by:
      `getRoot` in interface `Hierarchy<T>`

  - ### getParent

    public T getParent(T child)
    Specified by:
      `getParent` in interface `Hierarchy<T>`

  - ### hasChild

    public boolean hasChild(T parent)
    Specified by:
      `hasChild` in interface `Hierarchy<T>`

  - ### getChildren

    public Iterable<T> getChildren(T parent)
    Specified by:
      `getChildren` in interface `Hierarchy<T>`

  - ### getChild

    public T getChild(T parent, int index)
    Specified by:
      `getChild` in interface `Hierarchy<T>`

  - ### getChildCount

    public int getChildCount(T parent)
    Specified by:
      `getChildCount` in interface `Hierarchy<T>`

  - ### getIndexOfChild

    public int getIndexOfChild(T parent, T child)
    Specified by:
      `getIndexOfChild` in interface `Hierarchy<T>`

  - ### containsChild

    public boolean containsChild(T parent, T child)
    Specified by:
      `containsChild` in interface `Hierarchy<T>`

  - ### containsChild

    public boolean containsChild(T child)
    Specified by:
      `containsChild` in interface `Hierarchy<T>`

  - ### getChildList

    public List<T> getChildList(T parent)
    Specified by:
      `getChildList` in interface `Hierarchy<T>`

  - ### addChild

    public T addChild(T parent, T child)
    Specified by:
      `addChild` in interface `MutableHierarchy<T>`

  - ### setChildren

    public void setChildren(T parent, List<T> children)
    Specified by:
      `setChildren` in interface `MutableHierarchy<T>`

  - ### addChildren

    public void addChildren(T parent, List<T> children)
    Specified by:
      `addChildren` in interface `MutableHierarchy<T>`

  - ### removeChildren

    public void removeChildren(List<T> children)
    Specified by:
      `removeChildren` in interface `MutableHierarchy<T>`

  - ### insertChild

    public void insertChild(T parent, int index, T child)
    Specified by:
      `insertChild` in interface `MutableHierarchy<T>`

  - ### removeAll

    public void removeAll()
    Specified by:
      `removeAll` in interface `MutableHierarchy<T>`

  - ### removeChild

    public void removeChild(T parent, T child)
    Specified by:
      `removeChild` in interface `MutableHierarchy<T>`

  - ### moveChild

    public void moveChild(T oldParent, T newParent, int insertionPoint, T child)
    Specified by:
      `moveChild` in interface `MutableHierarchy<T>`