Package org.cip4.jdflib.util
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 java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description FastFiFo(int n)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetFill()xpeek(int i)peeks into the fifo from the beginningx[]peekArray()peeks into the fifo from the beginningxpop()pops the first to goxpush(x back)pushes an element into the back and returns the previous content of the cellintsize()java.lang.StringtoString()
-
-
-
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:
toStringin classjava.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
-
-