Question: pls write a Circular Doubly Linked chain java class that implements the following interface. that means the class must have a inner class Node that

pls write a Circular Doubly Linked chain java class that implements the following interface.

that means the class must have a inner class Node that can indicates previous Node and next Node.

Also, the should be only 1 instance variable which references the firstNode in the class you write.

/** An interface for the ADT deque. @author Frank M. Carrano @author Timothy M. Henry @version 4.0 */ public interface DequeInterface { /** Adds a new entry to the front/back of this dequeue. @param newEntry An object to be added. */ public void addToFront(T newEntry); public void addToBack(T newEntry); /** Removes and returns the front/back entry of this dequeue. @return The object at the front/back of the dequeue. @throws EmptyQueueException if the dequeue is empty before the operation. */ public T removeFront(); public T removeBack(); /** Retrieves the front/back entry of this dequeue. @return The object at the front/back of the dequeue. @throws EmptyQueueException if the dequeue is empty before the operation. */ public T getFront(); public T getBack(); /* Detects whether this dequeue is empty. @return True if the queue is empty, or false otherwise. */ public boolean isEmpty(); /* Removes all entries from this dequeue. */ public void clear(); } // end DequeInterface

Here is an exception class that you may use

/** A class of runtime exceptions thrown by methods to indicate that a queue is empty. @author Frank M. Carrano @author Timothy M. Henry */ public class EmptyQueueException extends RuntimeException { public EmptyQueueException() { this(null); } // end default constructor public EmptyQueueException(String message) { super(message); } // end constructor } // end EmptyQueueException

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!