org.ddogleg.struct
Class CircularQueue_I32
- java.lang.Object
-
- org.ddogleg.struct.CircularQueue_I32
-
public class CircularQueue_I32 extends java.lang.ObjectA circular queue which can grow as needed.
-
-
Constructor Summary
Constructors Constructor and Description CircularQueue_I32()CircularQueue_I32(int dataSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(int value)Adds a new element to the queue.voidaddW(int value)Adds a new element to the queue, but if the queue is full write over the oldest element.intget(int index)Returns the element in the queue at index.inthead()Value of the first element in the queuebooleanisEmpty()booleanisFull()intpopHead()Returns and removes the first element from the queue.intpopTail()Returns and removes the last element from the queue.voidremoveHead()Removes the first elementvoidremoveTail()Removes the last elementvoidreset()intsize()inttail()Value of the last element in the queue
-
-
-
Constructor Detail
-
CircularQueue_I32
public CircularQueue_I32()
-
CircularQueue_I32
public CircularQueue_I32(int dataSize)
-
-
Method Detail
-
reset
public void reset()
-
popHead
public int popHead()
Returns and removes the first element from the queue.- Returns:
- first element in the queue
-
popTail
public int popTail()
Returns and removes the last element from the queue.- Returns:
- last element in the queue
-
head
public int head()
Value of the first element in the queue
-
tail
public int tail()
Value of the last element in the queue
-
removeHead
public void removeHead()
Removes the first element
-
removeTail
public void removeTail()
Removes the last element
-
get
public int get(int index)
Returns the element in the queue at index. No bounds check is performed and a garbage value might be returned.- Parameters:
index- Which element in the queue you wish to access- Returns:
- the element's value
-
add
public void add(int value)
Adds a new element to the queue. If the queue isn't large enough to store this value then its internal data array will grow- Parameters:
value- Value which is to be added
-
addW
public void addW(int value)
Adds a new element to the queue, but if the queue is full write over the oldest element.- Parameters:
value- Value which is to be added
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
isFull
public boolean isFull()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG