public class BoundedQueue<E> extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| private java.util.ArrayList<E> | elements | 
| private int | head | 
| private java.util.concurrent.locks.Lock | queueLock | 
| private int | size | 
| private java.util.concurrent.locks.Condition | spaceAvailableCondition | 
| private int | tail | 
| private java.util.concurrent.locks.Condition | valueAvailableCondition | 
| 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. | 
| E | remove()Removes the object at the head. | 
private int head
private int tail
private int size
private java.util.concurrent.locks.Lock queueLock
private java.util.concurrent.locks.Condition spaceAvailableCondition
private java.util.concurrent.locks.Condition valueAvailableCondition
public BoundedQueue(int capacity)
capacity - the maximum capacity of the queue