Class FixedSizeQueue<T>
- java.lang.Object
-
- org.eclipse.nebula.widgets.opal.commons.FixedSizeQueue<T>
-
- Type Parameters:
T- Type of objects stored in this queue
public class FixedSizeQueue<T> extends java.lang.ObjectInstance of this class are queues that have a fixed size.
When the queue is full, the elements are shifted and the first element is lost.
-
-
Constructor Summary
Constructors Constructor Description FixedSizeQueue(int capacity)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetSize()java.util.List<T>getValues()voidput(T element)Store an element in the buffervoidresizeTo(int newSize)
-
-
-
Field Detail
-
buffer
private T[] buffer
-
index
private int index
-
-
Method Detail
-
put
public void put(T element)
Store an element in the buffer- Parameters:
element- element to store
-
getValues
public java.util.List<T> getValues()
- Returns:
- all values stored in this queue
-
getSize
public int getSize()
- Returns:
- size of the buffer
-
resizeTo
public void resizeTo(int newSize)
- Parameters:
newSize- new size of the buffer. If newSize is lower than the actual size, the buffer will contain the last elements that have been stored
-
-