Package org.ddogleg.struct
Class CircularArray_F64
java.lang.Object
org.ddogleg.struct.CircularArray_F64
A circular queue which can grow as needed.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double value) Adds a new element to the queue, but if the queue is full write over the oldest element.copy()
double
get
(int index) Returns the element in the queue at index.double
head()
Value of the first element in the queueboolean
isEmpty()
boolean
isFull()
double
popHead()
Returns and removes the first element from the queue.double
popTail()
Returns and removes the last element from the queue.int
void
Removes the first elementvoid
Removes the last elementvoid
reset()
void
resizeQueue
(int maxSize) void
set
(CircularArray_F64 original) int
size()
double
tail()
Value of the last element in the queue
-
Field Details
-
data
public double[] data -
start
public int start -
size
public int size
-
-
Constructor Details
-
CircularArray_F64
public CircularArray_F64() -
CircularArray_F64
public CircularArray_F64(int dataSize)
-
-
Method Details
-
reset
public void reset() -
popHead
public double popHead()Returns and removes the first element from the queue.- Returns:
- first element in the queue
-
popTail
public double popTail()Returns and removes the last element from the queue.- Returns:
- last element in the queue
-
head
public double head()Value of the first element in the queue -
tail
public double 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 double 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(double 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
-
set
-
copy
-
resizeQueue
public void resizeQueue(int maxSize) -
queueSize
public int queueSize() -
size
public int size() -
isEmpty
public boolean isEmpty() -
isFull
public boolean isFull()
-