Class AbstractTreeNode

    • Constructor Detail

      • AbstractTreeNode

        public AbstractTreeNode()
        Create a new instance of a AbstractTreeNode that serves as root for a tree.
    • Method Detail

      • setParent

        public void setParent​(TreeNode parent)
        Link to a parent node
        Parameters:
        parent - the parent to which this node will be linked as a child
        Throws:
        IllegalArgumentException - if parent is null or parent and child are identical
      • getRoot

        public TreeNode getRoot()
        Description copied from interface: TreeNode
        Get the root of the tree
        Returns:
        root node
      • addChild

        public void addChild​(TreeNode child)
        Description copied from interface: TreeNode
        Add a child node below this node. Children are registered in the order in which they are added.

        Important: this also automatically creates a link in the opposite direction. All implementations must adhere to this rule.

        Parameters:
        child - child node