Package org.quartz.utils
Class CircularLossyQueue<T>
- java.lang.Object
-
- org.quartz.utils.CircularLossyQueue<T>
-
- Type Parameters:
T
- Type of the item's to add in this queue
public class CircularLossyQueue<T> extends java.lang.Object
An implementation of a CircularQueue data-structure. When the number of items added exceeds the maximum capacity, items that were added first are lost.- Since:
- 1.7
- Author:
- Abhishek Sanoujam
-
-
Constructor Summary
Constructors Constructor Description CircularLossyQueue(int size)
Constructs the circular queue with the specified capacity
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
depth()
Returns the number of items currently in the queueboolean
isEmtpy()
Returns true if the queue is empty, otherwise falseT
peek()
Returns value at the tail of the queuevoid
push(T newVal)
Adds a new itemT[]
toArray(T[] type)
Returns an array of the current elements in the queue.
-
-
-
Method Detail
-
push
public void push(T newVal)
Adds a new item- Parameters:
newVal
-
-
toArray
public T[] toArray(T[] type)
Returns an array of the current elements in the queue. The order of elements is in reverse order of the order items were added.- Parameters:
type
-- Returns:
- An array containing the current elements in the queue. The first element of the array is the tail of the queue and the last element is the head of the queue
-
peek
public T peek()
Returns value at the tail of the queue- Returns:
- Value at the tail of the queue
-
isEmtpy
public boolean isEmtpy()
Returns true if the queue is empty, otherwise false- Returns:
- true if the queue is empty, false otherwise
-
depth
public int depth()
Returns the number of items currently in the queue- Returns:
- the number of items in the queue
-
-