The type of item contained inside.
Constructs a new CircularBuffer
from a dataset.
The initial data.
The data contained in the buffer.
The index of the end of the buffer.
The number of data elements in the buffer.
The index of the start of the buffer.
Generates an iterator for the buffer.
An iterator.
Returns the number of elements allocated.
The number of elements allocated.
Clears the buffer, setting its length to 0.
This doesn't deallocate any space.
Gets an element from the buffer. Errors on out of bound access.
The index to get.
The element at the index.
Utility function to get the last element of the buffer. Errors on an empty buffer.
The element at the back.
Pops a value from the start of the buffer.
The popped value.
Pops a value from the end of the buffer.
The popped value.
Expands the buffer if needed.
Shrinks the buffer if needed.
Pushes a value to the end of the buffer.
The value to push.
Pushes a value to the start of the buffer.
The value to push.
Resizes the buffer to a certain capacity.
This function also makes the buffer contiguous,
so toArray
will return faster.
If the capacity is too small, then it will automatically be scaled up to the length of the buffer.
The capacity to expand to.
Sets an element in the buffer. Errors on out of bounds access.
The index to set.
The value to set to.
Utility function to set the last element of the buffer. Errors on an empty buffer.
The value to set to.
Returns the number of elements in the buffer.
The number of elements.
Returns a shallow-copied array of the data.
This is faster than collecting the iterator.
The array.
Generated using TypeDoc
A circular buffer with constant time push and pop on both ends.