Class FastFiFo<x>

  • Type Parameters:
    x - the element class to dump into the fifo

    public class FastFiFo<x>
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      FastFiFo​(int n)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getFill()  
      x peek​(int i)
      peeks into the fifo from the beginning
      x[] peekArray()
      peeks into the fifo from the beginning
      x pop()
      pops the first to go
      x push​(x back)
      pushes an element into the back and returns the previous content of the cell
      int size()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FastFiFo

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

      • 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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • getFill

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

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