public class CircularBuffer extends java.lang.Object
Constructor and Description |
---|
CircularBuffer(int size)
Create a CircularBuffer with the provided size.
|
Modifier and Type | Method and Description |
---|---|
void |
addFirst(double value)
Push new value onto front of the buffer.
|
void |
addLast(double value)
Push new value onto back of the buffer.
|
void |
clear()
Sets internal buffer contents to zero.
|
double |
get(int index)
Get the element at the provided index relative to the start of the buffer.
|
double |
removeFirst()
Pop value at front of buffer.
|
double |
removeLast()
Pop value at back of buffer.
|
public CircularBuffer(int size)
size
- The size of the circular buffer.public void addFirst(double value)
public void addLast(double value)
public double removeFirst()
public double removeLast()
public void clear()
public double get(int index)