A circular buffer that holds a fixed-size collection. Can be used as a queue.
Create a new buffer.
size |
Initial size. The collection will be able to hold one minus this number of values. |
collectionClass |
Defaults to the Array class. |
The collection.
Current read position.
Current write position.
Maximum capacity.
Alias of -readable.
Number of readble items.
Number of writable items.
Add value and increase -writePos. Do nothing if no items can be written.
Return next readable item and increase -readPos. Return nil
if no items can be read.
Add value and increase -writePos by overwriting oldest readable item.
Iterate over the currently readable items.