Package org.deepjava.runtime.util
Class IntFifo
- java.lang.Object
-
- org.deepjava.runtime.util.IntFifo
-
public class IntFifo extends Object
First in first outInteger
queue. The size of the queue should be a multiple of 2 minus one (size = 2^x - 1).
-
-
Constructor Summary
Constructors Constructor Description IntFifo(int size)
Creates a newIntFifo
withsize
entries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
availToRead()
Reads the available entries in the queue.int
availToWrite()
Reads the available space left in the queue.void
clear()
Clears the queue.int
dequeue()
Removes oneInteger
from the queue.void
enqueue(int data)
Inserts oneInteger
into the queue.int
getSize()
Reads the maximum number of entries in the queue.
-
-
-
Field Detail
-
NO_DATA
public static final int NO_DATA
- See Also:
- Constant Field Values
-
data
int[] data
-
head
int head
-
tail
int tail
-
size
int size
-
-
Method Detail
-
enqueue
public void enqueue(int data)
Inserts oneInteger
into the queue.- Parameters:
data
-Integer
which will be inserted into the queue
-
dequeue
public int dequeue()
Removes oneInteger
from the queue.- Returns:
- The removed Integer or @see
NO_DATA
if no data is present
-
clear
public void clear()
Clears the queue.
-
availToRead
public int availToRead()
Reads the available entries in the queue.- Returns:
- The available
Integers
to read.
-
availToWrite
public int availToWrite()
Reads the available space left in the queue.- Returns:
- The available queue space.
-
getSize
public int getSize()
Reads the maximum number of entries in the queue.- Returns:
- The size of the queue.
-
-