Part-1(Java) Create a doubly linked list based DeQueDLL class that implements the DequeInterface. The class skeleton and interface are provided to you. Implement a String toString () method that creates and returns a string that correctly represents the current deque. Such a method could prove useful for testing and debugging the class and for testing and debugging applications that use the class. Assume each queued element already provides its own reasonable toString method. Skeleton: import ch04.queues.*;import support.DLLNode; public class DeQueDLL<T> implements DequeInterface<T> {protected DLLNode<T> front, rear; // reference to the front and rear of this dequeprotected int numElements = 0; // number of elements in this deque public DeQueDLL() {front = null;rear = null;} public void enqueueFront(T element) {// TODO Auto-generated method stub} public void enqueueRear(T element) {// TODO Auto-generated method stub} public T dequeueFront() throws QueueUnderflowException {// TODO Auto-generated method stubreturn null;} public T dequeueRear() throws QueueUnderflowException {// TODO Auto-generated method stubreturn null;} public boolean isFull() {// TODO Auto-generated method stubreturn false;} public boolean isEmpty() {// TODO Auto-generated method stubreturn false;} public int size() {// TODO Auto-generated method stubreturn 0;} }   import ch04.queues.QueueOverflowException;import ch04.queues.QueueUnderflowException; public interface DequeInterface<T>{void enqueueFront(T element) throws QueueOverflowException;// Throws QueueOverflowException if this queue is full;// otherwise, adds element to the front of this queue. void enqueueRear(T element) throws QueueOverflowException;// Throws QueueOverflowException if this queue is full;// otherwise, adds element to the rear of this queue. T dequeueFront() throws QueueUnderflowException;// Throws QueueUnderflowException if this queue is empty;// otherwise, removes front element from this queue and returns it. T dequeueRear() throws QueueUnderflowException;// Throws QueueUnderflowException if this queue is empty;// otherwise, removes rear element from this queue and returns it. boolean isFull();// Returns true if this queue is full; otherwise, returns false. boolean isEmpty();// Returns true if this queue is empty; otherwise, returns false.int size();// Returns the number of elements in this queue. }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

Part-1(Java)

  1. Create a doubly linked list based DeQueDLL class that implements the DequeInterface. The class skeleton and interface are provided to you.
  2. Implement a String toString () method that creates and returns a string that correctly represents the current deque. Such a method could prove useful for testing and debugging the class and for testing and debugging applications that use the class. Assume each queued element already provides its own reasonable toString method.

Skeleton:

import ch04.queues.*;
import support.DLLNode;

public class DeQueDLL<T> implements DequeInterface<T> {

protected DLLNode<T> front, rear; // reference to the front and rear of this deque
protected int numElements = 0; // number of elements in this deque

public DeQueDLL() {
front = null;
rear = null;
}

public void enqueueFront(T element) {
// TODO Auto-generated method stub

}

public void enqueueRear(T element) {
// TODO Auto-generated method stub

}

public T dequeueFront() throws QueueUnderflowException {
// TODO Auto-generated method stub
return null;
}

public T dequeueRear() throws QueueUnderflowException {
// TODO Auto-generated method stub
return null;
}

public boolean isFull() {
// TODO Auto-generated method stub
return false;
}

public boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}

public int size() {
// TODO Auto-generated method stub
return 0;
}

}

 

import ch04.queues.QueueOverflowException;
import ch04.queues.QueueUnderflowException;

public interface DequeInterface<T>
{
void enqueueFront(T element) throws QueueOverflowException;
// Throws QueueOverflowException if this queue is full;
// otherwise, adds element to the front of this queue.

void enqueueRear(T element) throws QueueOverflowException;
// Throws QueueOverflowException if this queue is full;
// otherwise, adds element to the rear of this queue.

T dequeueFront() throws QueueUnderflowException;
// Throws QueueUnderflowException if this queue is empty;
// otherwise, removes front element from this queue and returns it.

T dequeueRear() throws QueueUnderflowException;
// Throws QueueUnderflowException if this queue is empty;
// otherwise, removes rear element from this queue and returns it.

boolean isFull();
// Returns true if this queue is full; otherwise, returns false.

boolean isEmpty();
// Returns true if this queue is empty; otherwise, returns false.

int size();
// Returns the number of elements in this queue.

}

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education