Class FastFiFo<x>

java.lang.Object
org.cip4.jdflib.util.FastFiFo<x>
Type Parameters:
x - the element class to dump into the fifo

public class FastFiFo<x> extends Object
  • Constructor Details

    • FastFiFo

      public FastFiFo(int n)
      Parameters:
      n - size of the fifo
  • Method Details

    • push

      public x push(x back)
      pushes an element into the back and returns the previous content of the cell
      Parameters:
      back - the element to push
      Returns:
      the element that has been replaced, null if we are not yet full
    • pop

      public x pop()
      pops the first to go
      Returns:
      the first element, null if empty
    • peek

      public x peek(int i)
      peeks into the fifo from the beginning
      Parameters:
      i - the index of the element to peek
      Returns:
      the object at position i
    • peekArray

      public x[] peekArray()
      peeks into the fifo from the beginning
      Returns:
      a snapshot of the current fifo, null if empty
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • getFill

      public int getFill()
      Returns:
      the current number of elements
    • size

      public int size()
      Returns:
      the maximum total number of elements