Class RingBuffer<T>

A simple ring buffer to store the last n values of the timer. The buffer works on a First-In-First-Out (FIFO) basis.

Type Parameters

  • T

Hierarchy

  • RingBuffer

Constructors

Properties

Accessors

Methods

Constructors

Properties

buffer: T[]
capacity: number

The buffer's capacity.

head: number
size: number
tail: number

Accessors

  • get bottom(): T
  • Obtains the latest element (LIFO) without removing it. Throws an exception if a buffer is empty. Before calling this method, make sure that size > 0.

    Returns T

  • get top(): T
  • Obtains the oldest element (FIFO) without removing it. Throws an exception if a buffer is empty. Before calling this method, make sure that size > 0.

    Returns T

Methods

  • Obtains the oldest element (FIFO). May throw an exception if a buffer underrun occurs. Before calling this method, make sure that size > 0.

    Returns T

Generated using TypeDoc