Design and develop a class that represents a Queue Entry
in a
doubly-linked queue. This class will have the following private
attributes:
previous
- A pointer to the previous entry in the queue.
object
- A pointer to the Object
that is in this
entry in the queue.
next
- A pointer to the next entry in the queue.
Your class should have the following public
methods and constructors:
QueueEntry()
- A constructor that initializes all attributes to
null
.
QueueEntry(Object object)
- A constructor that sets the
object
attribute to the specified object and the other
attributes to null
.
get & set
methods for all the attributes.
Name this class QueueEntry
Place this class in the edu.cuny.lehman.cmp326.queue package.
Design and develop a class that represents a doubly-linked Queue
.
This class will have the following private
attributes:
head
- A pointer to the first QueueEntry
in the queue.
tail
- A pointer to the last QueueEntry
in the queue.
Your class should have the following public
methods and constructors:
Queue()
- A constructor that initializes the Queue
to contain no entries.
Queue(QueueEntry entry)
- A constructor that initializes the
Queue
to contain the specified QueueEntry
Queue(QueueEntry[] entries)
- A constructor that initializes the
Queue
to contain all the specified entries.
Queue(Object object)
- A constructor that initializes the
Queue
to contain all the specifies object. Note: The
specified object will need to be placed in a QueueEntry
before being added to the Queue
.
Queue(Object[] objects)
- A constructor that initializes the
Queue
to contain all the specified objects. The specifed
objects must added to Queue
in the same order as they
appear in the array. Note: The specified objects will each need to
be placed in a QueueEntry
before being added to the Queue
.
addEntry(QueueEntry entry)
- A method that adds the specified
entry to the back of the queue.
addEntries(QueueEntry[] entries)
- A method that adds the specified
entries to the queue in the same order as they appear in the array.
addObject(Object object)
- A method that adds the specified
object to the back of the queue. Note: The specified object
will each need to be placed in a QueueEntry
before being added to
the Queue
.
addObjects(Object[] objects)
- A method that adds the specified
objects to the queue in the order that they appear in the array.
Note: The specified objects will each need to
be placed in a QueueEntry
before being added to the Queue
.
getHead()
- Returns the head
of the queue.
getTail()
- Returns the tailg
of the queue.
getFirstEntry()
- A method that returns the first
QueueEntry
from the Queue
. This method will remove
the entry from the queue as well.
getFirstObject()
- A method that returns the Object
referred to in the first QueueEntry
from the Queue
.
This method will remove the first entry from the queue as well.
isEmpty()
- A method that returns true
if the
Queue
is empty, false
otherwise.
Name this class Queue
Place this class in the edu.cuny.lehman.cmp326.queue package.
Please submit the completed assignment on Blackboard by attaching all your .java files. Make sure to attach all your programs to each submission.