Page 1 of 1

**THIS PROBLEM IS IN JAVA** If a class is required to store data inside of a node, the getNode method that exists within

Posted: Fri Jul 01, 2022 5:51 am
by answerhappygod
**THIS PROBLEM IS IN JAVA**
If a class is required to store data inside of a node, thegetNode method that exists within the node class is called. It willconfirm the presence of a node in the storage, and make a new nodeis one does not already exist in that storage. That same new nodeis then returned and the amount of nodes is incremented. On theother hand, if the storage list is not empty, the head is separatedfrom the list and updated to store the value of the head as aparameter, and the removed node is returned with the number ofnodes not being incremented. If a value is to be deleted, thereleaseNode method will be called on the node with that value,where it will change the value of the node to null and then placethe node at the head of the storage list.
Node class defined below:
This Problem Is In Java If A Class Is Required To Store Data Inside Of A Node The Getnode Method That Exists Within 1
This Problem Is In Java If A Class Is Required To Store Data Inside Of A Node The Getnode Method That Exists Within 1 (456.09 KiB) Viewed 70 times
IS NUMNODES STATIC OR NON-STATIC?
COMPLETE A UNIT TEST THAT CONFIRMS THE NUMBER OF NODES ISCORRECT WHEN CALLING GETNODE. WRITE ANOTHER UNIT TEST THAT CONFIRMSTHE VALUE OF A NODE IS CHANGED TO NULL AFTER RELEASENODE ISCALLED.
COMPLETE A UNIT TEST THAT CONFIRMS THE NUMBER OF NODES ISCORRECT WHEN CALLING GETNODE AFTER RELEASENODE.
public class Node<E> { private E e; // Value for this node private Node<E> next; // Point to next node in list // Constructor Node (E it, Node<E> inn) { e = it; next = inn; } public E element () { return e; } // Return the value public void setElement (E it) { e = it; } // Set element value public Node<E> next () { return next; } // Return next node public void setNext (Node<E> inn) { next = inn; } // Set next node. *****/ * Extensions to support storage list **/ private static Node storagelist = null; // storage list for the class. // define the number of nodes created // TO DO /** *Return a new node, from storage list if it is not empty * @param it - the value to be stored in the new node * @param inn - the follower of the new node * @return the node is empty, a new node is created, if not the head of the * storage list is used to store it **/ public static <E> Node <E> getNode (E it, Node<E> inn) { // TODO } * containing the value it. If the storage list // Return a node to the storage list public void releaseNode () { // TODO } // int get NumNodes () : Return the number of nodes created // TODO To create a new node of String (without a follower node) we write Node <String> n = Node.getNode ("Hello", null); and to release that same node we write n. release ();