public class DoubleLinkedQueue
extends java.lang.Object
implements java.lang.Cloneable
DoubleLinkedQueue
is a queue of double values.
Limitations:
Beyond Int.MAX_VALUE
items, size
is wrong.
Java Source Code for this class:
http://www.cs.colorado.edu/~main/edu/colorado/collections/DoubleLinkedQueue.java
Constructor and Description |
---|
DoubleLinkedQueue()
Initialize an empty queue.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Generate a copy of this queue.
|
double |
getFront()
Get the front item, removing it from this queue.
|
void |
insert(double item)
Put a new a new item in this queue.
|
boolean |
isEmpty()
Determine whether this queue is empty.
|
int |
size()
Accessor method to determine the number of items in this queue.
|
public DoubleLinkedQueue()
public java.lang.Object clone()
clone
in class java.lang.Object
DoubleLinkedQueue
before it can be used.java.lang.OutOfMemoryError
- Indicates insufficient memory for creating the clone.public double getFront()
java.util.NoSuchElementException
- Indicates that this queue is empty.public void insert(double item)
item
- the item to be pushed onto this queue
Postcondition:
The item has been pushed onto this queue.java.lang.OutOfMemoryError
- Indicates insufficient memory for increasing the queue's capacity.
Note:
An attempt to increase the capacity beyond
Integer.MAX_VALUE
will cause the queue to fail with an
arithmetic overflow.public boolean isEmpty()
true
if this queue is empty;
false
otherwise.public int size()