public class BoundedQueue<E> extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
debug |
private java.util.ArrayList<E> |
elements |
private int |
head |
private int |
size |
private int |
tail |
Constructor and Description |
---|
BoundedQueue(int capacity)
Constructs an empty queue.
|
Modifier and Type | Method and Description |
---|---|
void |
add(E newValue)
Appends an object at the tail.
|
boolean |
isEmpty() |
boolean |
isFull() |
E |
remove()
Removes the object at the head.
|
void |
setDebug(boolean newValue) |
private int head
private int tail
private int size
private boolean debug
public BoundedQueue(int capacity)
capacity
- the maximum capacity of the queuepublic E remove()
Precondition: !isEmpty()
public void add(E newValue)
newValue
- the object to be appended
Precondition: !isFull();
public boolean isFull()
public boolean isEmpty()
public void setDebug(boolean newValue)