Class Node

  • Direct Known Subclasses:
    Leaf, XNode, YNode

    public abstract class Node
    extends Object
    Represents an abstract tree node with parents, left child, and right child.

    The abstract node holds no data; extensions hold different types of data.

    Author:
    Tyler Chenhall
    • Constructor Detail

      • Node

        protected Node()
    • Method Detail

      • getParentNode

        public Node getParentNode()
        Get the last parent node assigned to this Node. This method is outdated since Nodes may have multiple parents in the final implementation
        Returns:
        The value last stored as a parent Node
      • getParentNodes

        public List<Node> getParentNodes()
        This is an updated method which returns the ArrayList of parents Nodes. It returns the original object, hence trusts the user not to modify this list
        Returns:
        The ArrayList containing all parent nodes
      • setParentNode

        public void setParentNode​(Node newParent)
        Add a parent to the list for this Node
        Parameters:
        newParent - The new parent Node to add
      • getLeftChildNode

        public Node getLeftChildNode()
        Get the left child node of this Node
        Returns:
        The left child node
      • setLeftChildNode

        public void setLeftChildNode​(Node newLChild)
        Sets the left child node. (Also sets the parent node of the new child to this)
        Parameters:
        newLChild - The new left child node
      • getRightChildNode

        public Node getRightChildNode()
        Get the right child node of this Node
        Returns:
        The right child node
      • setRightChildNode

        public void setRightChildNode​(Node newRChild)
        Sets the right child node. (Also sets the parent node of the new child to this)
        Parameters:
        newRChild - The new right child node