Interface Queue<T>


  • public interface Queue<T>
    A finite Queue.
    Author:
    mrk
    • 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