org.rrd4j.core

## Class RobinMatrix

- java.lang.Object
- - org.rrd4j.core.RobinMatrix

- All Implemented Interfaces:
    Robin, RrdUpdater<Robin>

      class RobinMatrix
      extends Object
      implements Robin

  Class to represent archive values for a single datasource. Robin class is the heart of the so-called "round robin database" concept. Basically, each Robin object is a fixed length array of double values. Each double value reperesents consolidated, archived value for the specific timestamp. When the underlying array of double values gets completely filled, new values will replace the oldest ones.

  Robin object does not hold values in memory - such object could be quite large. Instead of it, Robin reads them from the backend I/O only when necessary.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RobinMatrix(Archive parentArc, RrdDoubleMatrix<Archive> values, RrdInt<Archive> pointer, int column)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `bulkStore(double newValue, int bulkCount)` bulkStore.
    `void` | `copyStateTo(Robin robin)` copyStateTo.
    `String` | `dump()` dump.
    `void` | `filterValues(double minValue, double maxValue)` Filters values stored in this archive based on the given boundary.
    `Archive` | `getParent()` Returns the Archive object to which this Robin object belongs.
    `RrdAllocator` | `getRrdAllocator()` Required to implement RrdUpdater interface.
    `RrdBackend` | `getRrdBackend()` Returns the underlying storage (backend) object which actually performs all I/O operations.
    `int` | `getSize()` Returns the size of the underlying array of archived values.
    `double` | `getValue(int index)` Returns the i-th value from the Robin archive.
    `double[]` | `getValues()` Fetches all archived values.
    `double[]` | `getValues(int index, int count)` getValues.
    `void` | `setValue(int index, double value)` Sets the i-th value in the Robin archive.
    `void` | `setValues(double... newValues)` Updates archived values in bulk.
    `void` | `setValues(double newValue)` (Re)sets all values in this archive to the same value.
    `void` | `store(double newValue)` store.
    `void` | `update(double[] newValues)` update.

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

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

- - ### Constructor Detail

    - #### RobinMatrix

          RobinMatrix(Archive parentArc,
                      RrdDoubleMatrix<Archive> values,
                      RrdInt<Archive> pointer,
                      int column)

  - ### Method Detail

    - #### bulkStore

          public void bulkStore(double newValue,
                                int bulkCount)
                         throws IOException

      bulkStore.
      Specified by:
        `bulkStore` in interface `Robin`
      Parameters:
        `newValue` - a double.
        `bulkCount` - a int.
      Throws:
        `IOException` - if any.

    - #### copyStateTo

          public void copyStateTo(Robin robin)
                           throws IOException

      copyStateTo.

      Copies object's internal state to another Robin object.

      Copies object's internal state to another Robin object.

      Specified by:
        `copyStateTo` in interface `Robin`
      Specified by:
        `copyStateTo` in interface `RrdUpdater<Robin>`
      Parameters:
        `robin` - a `RrdUpdater` object.
      Throws:
        `IOException` - if any.

    - #### dump

          public String dump()
                      throws IOException

      dump.
      Specified by:
        `dump` in interface `Robin`
      Returns:
        a `String` object.
      Throws:
        `IOException` - if any.

    - #### filterValues

          public void filterValues(double minValue,
                                   double maxValue)
                            throws IOException

      Filters values stored in this archive based on the given boundary. Archived values found to be outside of `[minValue, maxValue]` interval (inclusive) will be silently replaced with `NaN`.

      Filters values stored in this archive based on the given boundary. Archived values found to be outside of `[minValue, maxValue]` interval (inclusive) will be silently replaced with `NaN`.

      Specified by:
        `filterValues` in interface `Robin`
      Parameters:
        `minValue` - lower boundary
        `maxValue` - upper boundary
      Throws:
        `IOException` - Thrown in case of I/O error

    - #### getParent

          public Archive getParent()

      Returns the Archive object to which this Robin object belongs.
      Specified by:
        `getParent` in interface `Robin`
      Returns:
        Parent Archive object

    - #### getRrdAllocator

          public RrdAllocator getRrdAllocator()

      Required to implement RrdUpdater interface. You should never call this method directly.
      Specified by:
        `getRrdAllocator` in interface `Robin`
      Specified by:
        `getRrdAllocator` in interface `RrdUpdater<Robin>`
      Returns:
        Allocator object

    - #### getRrdBackend

          public RrdBackend getRrdBackend()

      Returns the underlying storage (backend) object which actually performs all I/O operations.
      Specified by:
        `getRrdBackend` in interface `Robin`
      Specified by:
        `getRrdBackend` in interface `RrdUpdater<Robin>`
      Returns:
        I/O backend object

    - #### getSize

          public int getSize()

      Returns the size of the underlying array of archived values.
      Specified by:
        `getSize` in interface `Robin`
      Returns:
        Number of stored values

    - #### getValue

          public double getValue(int index)
                          throws IOException

      Returns the i-th value from the Robin archive.

      Returns the i-th value from the Robin archive.

      Specified by:
        `getValue` in interface `Robin`
      Parameters:
        `index` - Value index
      Returns:
        Value stored in the i-th position (the oldest value has zero index)
      Throws:
        `IOException` - Thrown in case of I/O specific error.

    - #### getValues

          public double[] getValues()
                             throws IOException

      Fetches all archived values.
      Specified by:
        `getValues` in interface `Robin`
      Returns:
        Array of double archive values, starting from the oldest one.
      Throws:
        `IOException` - Thrown in case of I/O specific error.

    - #### getValues

          public double[] getValues(int index,
                                    int count)
                             throws IOException

      getValues.
      Specified by:
        `getValues` in interface `Robin`
      Parameters:
        `index` - a int.
        `count` - a int.
      Returns:
        an array of double.
      Throws:
        `IOException` - if any.

    - #### setValue

          public void setValue(int index,
                               double value)
                        throws IOException

      Sets the i-th value in the Robin archive.

      Sets the i-th value in the Robin archive.

      Specified by:
        `setValue` in interface `Robin`
      Parameters:
        `index` - index in the archive (the oldest value has zero index)
        `value` - value to be stored
      Throws:
        `IOException` - Thrown in case of I/O specific error.

    - #### setValues

          public void setValues(double... newValues)
                         throws IOException

      Updates archived values in bulk.

      Updates archived values in bulk.

      Specified by:
        `setValues` in interface `Robin`
      Parameters:
        `newValues` - Array of double values to be stored in the archive
      Throws:
        `IOException` - Thrown in case of I/O error

    - #### setValues

          public void setValues(double newValue)
                         throws IOException

      (Re)sets all values in this archive to the same value.

      (Re)sets all values in this archive to the same value.

      Specified by:
        `setValues` in interface `Robin`
      Parameters:
        `newValue` - New value
      Throws:
        `IOException` - Thrown in case of I/O error

    - #### store

          public void store(double newValue)
                     throws IOException

      store.
      Specified by:
        `store` in interface `Robin`
      Parameters:
        `newValue` - a double.
      Throws:
        `IOException` - if any.

    - #### update

          public void update(double[] newValues)
                      throws IOException

      update.
      Specified by:
        `update` in interface `Robin`
      Parameters:
        `newValues` - an array of double.
      Throws:
        `IOException` - if any.