Class DefaultTreeNode<T>

  • Type Parameters:
    T - type of data associated with the node
    All Implemented Interfaces:
    TreeNode<T>

    public class DefaultTreeNode<T>
    extends Object
    implements TreeNode<T>
    Default implementation of TreeNode.
    Author:
    Alison Walter
    • Constructor Detail

      • DefaultTreeNode

        public DefaultTreeNode​(T data,
                               TreeNode<?> parent)
        Creates a new tree node wrapping the given data, located in the tree beneath the specified parent.
        Parameters:
        data - The data to wrap.
        parent - The parent node of the tree.
    • Method Detail

      • data

        public T data()
        Description copied from interface: TreeNode
        Gets the data associated with the node.
        Specified by:
        data in interface TreeNode<T>
      • parent

        public TreeNode<?> parent()
        Description copied from interface: TreeNode
        Gets the parent of this node.
        Specified by:
        parent in interface TreeNode<T>
      • children

        public List<TreeNode<?>> children()
        Description copied from interface: TreeNode
        Gets the node's children. If this list is mutated, the children will be affected accordingly. It is the responsibility of the caller to ensure continued integrity, particularly of parent linkages.
        Specified by:
        children in interface TreeNode<T>