Class TreeNode

    • Field Detail

      • value

        protected Object value
        The value contained in this node. This value may be anything.
    • Constructor Detail

      • TreeNode

        public TreeNode​(Object value)
        Constructs a new instance of TreeNode.
        value - The value held by this node; may be anything.
    • Method Detail

      • getChildren

        public TreeNode[] getChildren()
        Returns the child nodes. Empty arrays are converted to null before being returned.
        The child nodes; may be null, but never empty. There should be no null children in the array.
      • getParent

        public TreeNode getParent()
        Returns the parent node.
        The parent node; may be null if there are no parent nodes.
      • getValue

        public Object getValue()
        Returns the value held by this node.
        The value; may be anything.
      • hasChildren

        public boolean hasChildren()
        Returns whether the tree has any children.
        true if its array of children is not null and is non-empty; false otherwise.
      • hashCode

        public int hashCode()
        hashCode in class Object
      • setChildren

        public void setChildren​(TreeNode[] children)
        Sets the children for this node.
        children - The child nodes; may be null or empty. There should be no null children in the array.
      • setParent

        public void setParent​(TreeNode parent)
        Sets the parent for this node.
        parent - The parent node; may be null.