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 Variableextends 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
    Description
    static class 
    Calculate the average of the data points.
    (package private) static final class 
    The sort used by rrdtool for percent, where NaN < -INF < finite values < INF
    static class 
    Find the first valid data point and it's timestamp
    static class 
    Find the first last valid point and it's timestamp
    static class 
    Calculate the correlation coefficient of the least squares line.
    static class 
    Calculate the y-intercept of the least squares line.
    static class 
    Calculate the slop of the least squares line.
    static class 
    The biggest of the data points, stamped with the latest point attaining it.
    static class 
    The smallest of the data points, stamped with the latest point attaining it.
    (package private) static final class 
    Store all the informations about a datasource point, for predictive and consistent sorting
    static class 
    Find the point at the n-th percentile.
    static class 
    Percentile calculation that leaves gap entries out of the ranking.
    static class 
    Calculate the standard deviation for the data point.
    static class 
    Calculate the sum of the data points.
    static final class 
    This class store both the value and the time stamp It will be used by graph rendering legend
  • Field Summary

    Modifier and Type
    Field
    Description
    static final Variable.Value
    Represents an invalid value with NaN (Not a Number) value.
    The computed value, null until the value has been filled in.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Base constructor for Variable subclasses
  • Method Summary

    Modifier and Type
    Method
    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.
    Returns the value left by the last calculate(Source, long, long) call.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INVALIDVALUE

      public static final Variable.Value INVALIDVALUE
      Represents an invalid value with NaN (Not a Number) value.
    • val

      private Variable.Value val
      The computed value, null until the value has been filled in.
  • Constructor Details

    • Variable

      protected Variable()
      Base constructor for Variable subclasses
  • Method Details

    • 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).

      Only the points whose step interval overlaps the window are passed on; a VDef source is instead kept or discarded as a whole, based on where its value is stamped.

      Parameters:
      s - source supplying the timestamped values to compute over
      start - lower bound of the window, in seconds since epoch
      end - upper bound of the window, in seconds since epoch
    • getValue

      public Variable.Value getValue()
      Returns the value left by the last calculate(Source, long, long) call.
      Returns:
      the computed value, INVALIDVALUE if the source held no point in the window
    • 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