Class DefaultTreeForTreeLayout<TreeNode>

    • Constructor Detail

      • DefaultTreeForTreeLayout

        public DefaultTreeForTreeLayout​(TreeNode root)
        Creates a new instance with a given node as the root
        Parameters:
        root - the node to be used as the root.
    • Method Detail

      • getEmptyList

        private java.util.List<TreeNode> getEmptyList()
      • getChildrenList

        public java.util.List<TreeNode> getChildrenList​(TreeNode node)
        Description copied from class: AbstractTreeForTreeLayout
        Return the children of a node as a List.

        Time Complexity: O(1)

        Also the access to an item of the list must have time complexity O(1).

        A client must not modify the returned list.

        Specified by:
        getChildrenList in class AbstractTreeForTreeLayout<TreeNode>
        Parameters:
        node -  
        Returns:
        the children of the given node. When node is a leaf the list is empty.
      • hasNode

        public boolean hasNode​(TreeNode node)
        Parameters:
        node -  
        Returns:
        true iff the node is in the tree
      • addChild

        public void addChild​(TreeNode parentNode,
                             TreeNode node)
        Parameters:
        parentNode - [hasNode(parentNode)]
        node - [!hasNode(node)]
      • addChildren

        public void addChildren​(TreeNode parentNode,
                                TreeNode... nodes)