Class SafeLinkedList.Node

    • Field Detail

      • m_object

        protected Object m_object
        The value stored in the Node.
    • Constructor Detail

      • Node

        public Node()
        Construct a blank Node.
      • Node

        public Node​(Object o)
        Construct a Node with a value.
        Parameters:
        o - the value to store in the Node
    • Method Detail

      • getObject

        public Object getObject()
        Returns:
        the Node's Object value
      • setObject

        protected void setObject​(Object o)
        Parameters:
        o - the new Object value for this Node
      • getNext

        public SafeLinkedList.Node getNext()
        Returns:
        the Node that follows this Node or null
      • getPrevious

        public SafeLinkedList.Node getPrevious()
        Returns:
        the Node that precedes this Node or null
      • linkBefore

        protected void linkBefore​(SafeLinkedList.Node next)
        Add this Node to the List preceding the specified Node.
        Parameters:
        next - the Node to add this Node before
      • linkAfter

        protected void linkAfter​(SafeLinkedList.Node prev)
        Add this Node to the List following the specified Node.
        Parameters:
        prev - the Node to add this Node after
      • delink

        protected void delink()
        Remove this Node from the List.
      • discard

        protected Object discard()
        Delink this Node and discard its value.
        Returns:
        the value of this Node before it was discarded
      • equals

        public boolean equals​(Object that)
        Compare this Node with an object for equality.
        Overrides:
        equals in class Object
        Returns:
        true if the other object is a Node with an equal value
      • equalsValue

        public boolean equalsValue​(Object oThat)
        Compare this Node's value with another value for equality.
        Returns:
        true if the specified object is equal to this Node's value
      • toString

        public String toString()
        Render the Node as a String.
        Overrides:
        toString in class Object
        Returns:
        the details about this Node.
      • clone

        public Object clone()
        Overrides:
        clone in class Object
        Returns:
        a Clone of this node