Class TreeNode<T extends TreeNode<T>>

java.lang.Object
org.ehrbase.openehr.util.TreeNode<T>
Type Parameters:
T -
Direct Known Subclasses:
PathCohesionAnalysis.PathCohesionTreeNode

public abstract class TreeNode<T extends TreeNode<T>> extends Object
A simple base for creating tree structures.
  • Field Details

  • Constructor Details

    • TreeNode

      public TreeNode()
  • Method Details

    • getParent

      public T getParent()
    • addChild

      protected T addChild(T child)
      Add the child to children. If it is already contained, nothing is changed. If it already has a parent, it is removed from the parent. In order to keep the tree acyclic, a IllegalArgumentException is thrown if the child ia an ancestor of this node.
      Parameters:
      child -
      Returns:
    • getChildren

      public List<T> getChildren()
    • sortChildren

      public void sortChildren(Comparator<T> comparator)
    • streamDepthFirst

      public Stream<T> streamDepthFirst()