edu.wpi.first.wpilibj

## Class CircularBuffer

- java.lang.Object
- - edu.wpi.first.wpilibj.CircularBuffer

-     public class CircularBuffer
      extends java.lang.Object

  This is a simple circular buffer so we don't need to "bucket brigade" copy old values.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CircularBuffer(int size)` Create a CircularBuffer with the provided size.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `get(int index)` Get the element at the provided index relative to the start of the buffer.
    `double` | `popBack()` Pop value at back of buffer.
    `double` | `popFront()` Pop value at front of buffer.
    `void` | `pushBack(double value)` Push new value onto back of the buffer.
    `void` | `pushFront(double value)` Push new value onto front of the buffer.
    `void` | `reset()` Sets internal buffer contents to zero.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CircularBuffer

          public CircularBuffer(int size)

      Create a CircularBuffer with the provided size.
      Parameters:
        `size` - The size of the circular buffer.

  - ### Method Detail

    - #### pushFront

          public void pushFront(double value)

      Push new value onto front of the buffer. The value at the back is overwritten if the buffer is full.

    - #### pushBack

          public void pushBack(double value)

      Push new value onto back of the buffer. The value at the front is overwritten if the buffer is full.

    - #### popFront

          public double popFront()

      Pop value at front of buffer.
      Returns:
        value at front of buffer

    - #### popBack

          public double popBack()

      Pop value at back of buffer.

    - #### reset

          public void reset()

      Sets internal buffer contents to zero.

    - #### get

          public double get(int index)

      Get the element at the provided index relative to the start of the buffer.
      Returns:
        Element at index starting from front of buffer.