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.Object
Instance 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

    Modifier and Type Method Description
    int getSize()  
    java.util.List<T> getValues()  
    void put​(T element)
    Store an element in the buffer
    void resizeTo​(int newSize)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FixedSizeQueue

      public FixedSizeQueue​(int capacity)
      Constructor
      Parameters:
      capacity - initial capacity
  • Method Details

    • 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