RingBuffer

internal class RingBuffer<T>(val capacity: Int) : Iterable<T> (source)

A ring buffer implementation that allows for a fixed-size buffer to be used as a sliding window. The buffer is circular and will overwrite the oldest elements when full.

Parameters

capacity

The maximum number of elements that the buffer can hold.

Constructors

Link copied to clipboard
constructor(capacity: Int)

Properties

Link copied to clipboard
private val buffer: Array<T?>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var pix: Int
Link copied to clipboard
val size: Int

Functions

Link copied to clipboard
fun add(element: T)
Link copied to clipboard
fun clear()
Link copied to clipboard
operator fun get(index: Int): T
Link copied to clipboard
open operator override fun iterator(): Iterator<T>
Link copied to clipboard
operator fun set(index: Int, element: T)
Link copied to clipboard
fun toList(): List<T?>