Package org.epics.pvdata.misc
Interface Queue<T>
-
public interface Queue<T>A finite Queue.- Author:
- mrk
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcapacity()Get the queue capacity.voidclear()Set all elements free.QueueElement<T>getFree()Get the next free element.intgetNumberFree()Get the number of free queue elements.QueueElement<T>getUsed()Get the oldest used element.voidreleaseUsed(QueueElement<T> queueElement)Release the getUsed structure.voidsetUsed(QueueElement<T> queueElement)Set the getFree element to used.
-
-
-
Method Detail
-
clear
void clear()
Set all elements free.
-
getNumberFree
int getNumberFree()
Get the number of free queue elements.- Returns:
- The number.
-
capacity
int capacity()
Get the queue capacity.- Returns:
- the capacity
-
getFree
QueueElement<T> getFree()
Get the next free element.- Returns:
- the next free element or null if no free elements
-
setUsed
void setUsed(QueueElement<T> queueElement)
Set the getFree element to used.- Parameters:
queueElement- the queueElement, which must be the element returned by the oldest call to getFree that was not setUsed- Throws:
IllegalStateException- if queueElement is not the element returned by the oldest call to getFree that was not setUsed
-
getUsed
QueueElement<T> getUsed()
Get the oldest used element.- Returns:
- The next used element or null if no used elements
-
releaseUsed
void releaseUsed(QueueElement<T> queueElement)
Release the getUsed structure.- Parameters:
queueElement- the queueElement, which must be the element returned by the most recent call to getUsed- Throws:
IllegalStateException- if queueElement is not the element returned by the most recent call to getUsed
-
-