public class DoubleCircularBuffer extends Object
| Constructor and Description |
|---|
DoubleCircularBuffer(double[] initalElements,
int capacity) |
DoubleCircularBuffer(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
int |
capacity() |
double[] |
elements() |
double |
get() |
double[] |
get(double[] into,
int length) |
double[] |
get(double[] into,
int readPos,
int length) |
double |
get(int readPos) |
protected int |
getIndex(int readPos) |
boolean |
isBufferFlipped() |
boolean |
put(double element)
add new element
|
int |
put(double[] newElements,
int length)
add multiple new elements
|
int |
put(double[] newElements,
int startIndex,
int length)
add multiple new elements
|
int |
remainingCapacity() |
double |
replace(double element) |
double |
replace(double element,
int atIndex) |
void |
reset()
resets and clears buffer
|
int |
writePosition() |
public DoubleCircularBuffer(double[] initalElements,
int capacity)
initalElements - adds element the buffer should be initialised withcapacity - maximum capacity of the bufferpublic DoubleCircularBuffer(int capacity)
capacity - maximum capacity of bufferpublic int available()
public int capacity()
public double[] elements()
public double get()
public double[] get(double[] into,
int length)
into - storage containerlength - number of elements to be readpublic double[] get(double[] into,
int readPos,
int length)
into - storage containerreadPos - circular index (wraps around)length - number of elements to be readpublic double get(int readPos)
readPos - circular index (wraps around)protected int getIndex(int readPos)
public boolean isBufferFlipped()
public boolean put(double element)
element - new elementpublic int put(double[] newElements,
int length)
newElements - array of new elementslength - number of elements that are to be written from arraypublic int put(double[] newElements,
int startIndex,
int length)
newElements - array of new elementsstartIndex - 'null'length - number of elements that are to be written from arraypublic int remainingCapacity()
public double replace(double element)
element - to replace an existing element at the head buffer positionpublic double replace(double element,
int atIndex)
element - to replace an existing element at given buffer positionatIndex - index at which to replace the valuepublic void reset()
public int writePosition()
Copyright © 2020 GSI Helmholtzzentrum für Schwerionenforschung GmbH. All rights reserved.