org.rrd4j.data

## Class Variable

- java.lang.Object
- - org.rrd4j.data.Variable

- Direct Known Subclasses:
    Variable.AVERAGE, Variable.FIRST, Variable.LAST, Variable.LSLCORREL, Variable.LSLINT, Variable.LSLSLOPE, Variable.MAX, Variable.MIN, Variable.PERCENTILE, Variable.STDDEV, Variable.TOTAL

      public abstract class Variable
      extends Object

  Abstract class for extracting single values from data sets (VDEF in rrdtool).
  Provides statistical calculations on RRD values and supports custom computation methods for advanced data processing.

  Can be used to add new statistical calculations with RRD values.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Variable.AVERAGE` Calculate the average of the data points.
    `(package private) static class` | `Variable.ComparPercentElemen` The sort used by rrdtool for percent, where NaN < -INF < finite values < INF
    `static class` | `Variable.FIRST` Find the first valid data point and it's timestamp
    `static class` | `Variable.LAST` Find the first last valid point and it's timestamp
    `static class` | `Variable.LSLCORREL` Calculate the correlation coefficient of the least squares line.
    `static class` | `Variable.LSLINT` Calculate the y-intercept of the least squares line.
    `static class` | `Variable.LSLSLOPE` Calculate the slop of the least squares line.
    `static class` | `Variable.MAX` The biggest of the data points and it's time stamp (the first one) is stored.
    `static class` | `Variable.MIN` The smallest of the data points and it's time stamp (the first one) is stored.
    `(package private) static class` | `Variable.PercentElem` Store all the informations about a datasource point, for predictive and consistent sorting
    `static class` | `Variable.PERCENTILE` Find the point at the n-th percentile.
    `static class` | `Variable.PERCENTILENAN`
    `static class` | `Variable.STDDEV` Calculate the standard deviation for the data point.
    `static class` | `Variable.TOTAL` Calculate the sum of the data points.
    `static class` | `Variable.Value` This class store both the value and the time stamp It will be used by graph rendering legend

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Variable.Value` | `INVALIDVALUE` Represents an invalid value with NaN (Not a Number) value.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Variable()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) void` | `calculate(Source s, long start, long end)` Used to calculate the needed value from a source, this method call the abstract method `fill(long[], double[], long, long)`.
    `protected abstract Variable.Value` | `fill(long[] timestamps, double[] values, long start, long end)` This method is call with the needed values, extracted from the datasource to do the calculation.
    `Variable.Value` | `getValue()`

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

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

- - ### Field Detail

    - #### INVALIDVALUE

          public static final Variable.Value INVALIDVALUE

      Represents an invalid value with NaN (Not a Number) value.

  - ### Constructor Detail

    - #### Variable

          public Variable()

  - ### Method Detail

    - #### calculate

          void calculate(Source s,
                         long start,
                         long end)

      Used to calculate the needed value from a source, this method call the abstract method `fill(long[], double[], long, long)`.
      Parameters:
        `s` -
        `start` -
        `end` -

    - #### fill

          protected abstract Variable.Value fill(long[] timestamps,
                                                 double[] values,
                                                 long start,
                                                 long end)

      This method is call with the needed values, extracted from the datasource to do the calculation.

      Value is to be filled with both the double value and a possible timestamp, when it's used to find a specific point

      Parameters:
        `timestamps` - the timestamps for the value
        `values` - the actual values
        `start` - the start of the period
        `end` - the end of the period
      Returns:
        a filled Value object

    - #### getValue

          public Variable.Value getValue()