org.rrd4j.core

## Class DsDef

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

-     public class DsDef
      extends Object

  Class to represent single data source definition within the RRD. Datasource definition consists of the following five elements:
  - data source name
  - data source type
  - heartbeat
  - minimal value
  - maximal value

  For the complete explanation of all source definition parameters, see RRDTool's rrdcreate man page.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) static String` | `FORCE_ZEROS_FOR_NANS_SUFFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DsDef(String dsName, DsType dsType, long heartbeat, double minValue, double maxValue)` Creates new data source definition object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `dump()` Returns string representing source definition (RRDTool format).
    `boolean` | `equals(Object obj)`
    `(package private) boolean` | `exactlyEqual(DsDef def)`
    `String` | `getDsName()` Returns data source name.
    `DsType` | `getDsType()` Returns source type.
    `long` | `getHeartbeat()` Returns source heartbeat.
    `double` | `getMaxValue()` Returns maximal calculated source value.
    `double` | `getMinValue()` Returns minimal calculated source value.
    `int` | `hashCode()`

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

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

- - ### Field Detail

    - #### FORCE_ZEROS_FOR_NANS_SUFFIX

          static final String FORCE_ZEROS_FOR_NANS_SUFFIX

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DsDef

          public DsDef(String dsName,
                       DsType dsType,
                       long heartbeat,
                       double minValue,
                       double maxValue)

      Creates new data source definition object. This object should be passed as argument to `addDatasource()` method of `RrdDb` object.

      For the complete explanation of all source definition parameters, see RRDTool's rrdcreate man page

      IMPORTANT NOTE: If datasource name ends with '!', corresponding archives will never store NaNs as datasource values. In that case, NaN datasource values will be silently replaced with zeros by the framework.

      Parameters:
        `dsName` - Data source name.
        `dsType` - Data source type. Valid values are "COUNTER", "GAUGE", "DERIVE" and "ABSOLUTE" (these string constants are conveniently defined in the `DsType` class).
        `heartbeat` - Hearbeat
        `minValue` - Minimal value. Use `Double.NaN` if unknown.
        `maxValue` - Maximal value. Use `Double.NaN` if unknown.

  - ### Method Detail

    - #### dump

          public String dump()

      Returns string representing source definition (RRDTool format).
      Returns:
        String containing all data source definition parameters.

    - #### equals

          public boolean equals(Object obj)

      Checks if two datasource definitions are equal. Source definitions are treated as equal if they have the same source name. It is not possible to create RRD with two equal archive definitions.

      Overrides:
        `equals` in class `Object`

    - #### exactlyEqual

          boolean exactlyEqual(DsDef def)

    - #### getDsName

          public String getDsName()

      Returns data source name.
      Returns:
        Data source name.

    - #### getDsType

          public DsType getDsType()

      Returns source type.
      Returns:
        Source type ("COUNTER", "GAUGE", "DERIVE" or "ABSOLUTE").

    - #### getHeartbeat

          public long getHeartbeat()

      Returns source heartbeat.
      Returns:
        Source heartbeat.

    - #### getMaxValue

          public double getMaxValue()

      Returns maximal calculated source value.
      Returns:
        Maximal value.

    - #### getMinValue

          public double getMinValue()

      Returns minimal calculated source value.
      Returns:
        Minimal value.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`