## org.jrobin.graph
Class ExportData

    java.lang.Object
      org.jrobin.graph.ExportData

All Implemented Interfaces:
  RrdDataSet

public class ExportData
extends java.lang.Object
implements RrdDataSet

ExportData represents a reduced dataset that is the result of a JRobin rrd export.

Constructor Summary
`ExportData(java.io.File xmlFile)` Create an ExportData object based on export XML file.
`ExportData(java.io.File xmlFile, boolean useLegendNames)` Create an ExportData object based on export XML file.
`ExportData(java.io.File xmlFile, java.lang.String dsNamePrefix)` Create an ExportData object based on export XML file.
`ExportData(java.lang.String xportXml)` Create an ExportData object based on export XML string..
`ExportData(java.lang.String xportXml, boolean useLegendNames)` Create an ExportData object based on export XML string..
`ExportData(java.lang.String xportXml, java.lang.String dsNamePrefix)` Create an ExportData object based on export XML string..

Method Summary
`java.lang.String` `exportXml()` Dumps the dataset to XML.
`void` `exportXml(java.io.OutputStream outputStream)` Dumps fetch data to output stream in XML format.
`void` `exportXml(java.lang.String filepath)` Dumps dataset to file in XML format.
`double` `getAggregate(java.lang.String dsName, java.lang.String consolFun)` Returns aggregated value from the dataset for a single datasource.
`int` `getColumnCount()` Returns the number of columns in this dataset.
`int` `getDsIndex(java.lang.String dsName)` Retrieve the table index number of a datasource by name.
`java.lang.String[]` `getDsNames()` Returns array of the names of all datasources in the set.
`long` `getFirstTimestamp()` Returns the first timestamp in the dataset.
`long` `getLastTimestamp()` Returns the last timestamp in the dataset.
`int` `getRowCount()` Returns the number of rows in this dataset.
`protected org.jrobin.graph.Source[]` `getSources()`
`long` `getStep()` Returns the step with which this data was fetched.
`long[]` `getTimestamps()` Returns an array of timestamps covering the whole range specified in the dataset object.
`double[][]` `getValues()` Returns all values for all datasources, the returned values correspond to the timestamps returned with the `getTimestamps()` method.
`double[]` `getValues(int dsIndex)` Returns all values for a single datasource, the returned values correspond to the timestamps returned with the `getTimestamps()` method.
`double[]` `getValues(java.lang.String dsName)` Returns all values for a single datasource.
`void` `importXml(java.io.File xmlFile)` Imports a export XML string and maps it back to this ExportData object.
`void` `importXml(java.io.File xmlFile, boolean useLegendNames)` Imports a export XML string and maps it back to this ExportData object.
`void` `importXml(java.io.File xmlFile, java.lang.String dsNamePrefix)` Imports a export XML string and maps it back to this ExportData object.
`void` `importXml(java.lang.String xportXml)` Imports a export XML string and maps it back to this ExportData object.
`void` `importXml(java.lang.String xportXml, boolean useLegendNames)` Imports a export XML string and maps it back to this ExportData object.
`void` `importXml(java.lang.String xportXml, java.lang.String dsNamePrefix)` Imports a export XML string and maps it back to this ExportData object.
`java.lang.String` `print(java.lang.String sourceName, java.lang.String consolFun, java.lang.String format)` Calculate the chosen consolidation function `consolFun` over the `sourceName` and returns the result as a string using the specified `format`.
`java.lang.String` `print(java.lang.String sourceName, java.lang.String consolFun, java.lang.String format, double base)` Calculate the chosen consolidation function `consolFun` over the `sourceName` and returns the result as a string using the specified `format`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ExportData

    public ExportData(java.lang.String xportXml)
               throws RrdException,
                      java.io.IOException

  Create an ExportData object based on export XML string..

Parameters:
  `xportXml` - File containing export xml.
Throws:
  `RrdException` - Thrown in case of JRobin specific exception.
  `java.io.IOException` - Thrown in case of I/O related exception.

### ExportData

    public ExportData(java.lang.String xportXml,
                      boolean useLegendNames)
               throws RrdException,
                      java.io.IOException

  Create an ExportData object based on export XML string..

Parameters:
  `xportXml` - File containing export xml.
  `useLegendNames` - Map datasources to legend items in the export xml.
Throws:
  `RrdException` - Thrown in case of JRobin specific exception.
  `java.io.IOException` - Thrown in case of I/O related exception.

### ExportData

    public ExportData(java.lang.String xportXml,
                      java.lang.String dsNamePrefix)
               throws RrdException,
                      java.io.IOException

  Create an ExportData object based on export XML string..

Parameters:
  `xportXml` - File containing export xml.
  `dsNamePrefix` - Prefix of the datasource names.
Throws:
  `RrdException` - Thrown in case of JRobin specific exception.
  `java.io.IOException` - Thrown in case of I/O related exception.

### ExportData

    public ExportData(java.io.File xmlFile)
               throws RrdException,
                      java.io.IOException

  Create an ExportData object based on export XML file.

Parameters:
  `xmlFile` - File containing export xml.
Throws:
  `RrdException` - Thrown in case of JRobin specific exception.
  `java.io.IOException` - Thrown in case of I/O related exception.

### ExportData

    public ExportData(java.io.File xmlFile,
                      boolean useLegendNames)
               throws RrdException,
                      java.io.IOException

  Create an ExportData object based on export XML file.

Parameters:
  `xmlFile` - File containing export xml.
  `useLegendNames` - Map datasources to legend items in the export xml.
Throws:
  `RrdException` - Thrown in case of JRobin specific exception.
  `java.io.IOException` - Thrown in case of I/O related exception.

### ExportData

    public ExportData(java.io.File xmlFile,
                      java.lang.String dsNamePrefix)
               throws RrdException,
                      java.io.IOException

  Create an ExportData object based on export XML file.

Parameters:
  `xmlFile` - File containing export xml.
  `dsNamePrefix` - Prefix of the datasource names.
Throws:
  `RrdException` - Thrown in case of JRobin specific exception.
  `java.io.IOException` - Thrown in case of I/O related exception.

Method Detail

### getRowCount

    public int getRowCount()

  Returns the number of rows in this dataset.

  Specified by:
    `getRowCount` in interface `RrdDataSet`
  Returns:
    Number of rows (data samples).

### getColumnCount

    public int getColumnCount()

  Returns the number of columns in this dataset.

  Specified by:
    `getColumnCount` in interface `RrdDataSet`
  Returns:
    Number of columns (datasources).

### getTimestamps

    public long[] getTimestamps()

  Returns an array of timestamps covering the whole range specified in the dataset object.

  Specified by:
    `getTimestamps` in interface `RrdDataSet`
  Returns:
    Array of equidistant timestamps.

### getStep

    public long getStep()

  Returns the step with which this data was fetched.

  Specified by:
    `getStep` in interface `RrdDataSet`
  Returns:
    Step as long.

### getValues

    public double[] getValues(int dsIndex)

  Returns all values for a single datasource, the returned values correspond to the timestamps returned with the `getTimestamps()` method.

  Specified by:
    `getValues` in interface `RrdDataSet`
  Parameters:
    `dsIndex` - Datasource index.
  Returns:
    Array of single datasource values.

### getValues

    public double[][] getValues()

  Returns all values for all datasources, the returned values correspond to the timestamps returned with the `getTimestamps()` method.

  Specified by:
    `getValues` in interface `RrdDataSet`
  Returns:
    Two-dimensional aray of all datasource values.

### getValues

    public double[] getValues(java.lang.String dsName)
                       throws RrdException

  Returns all values for a single datasource. The returned values correspond to the timestamps returned with the `getTimestamps()` method.

  Specified by:
    `getValues` in interface `RrdDataSet`
  Parameters:
    `dsName` - Datasource name.
  Returns:
    Array of single datasource values.
  Throws:
    `RrdException` - Thrown if no matching datasource name is found.

### getFirstTimestamp

    public long getFirstTimestamp()

  Returns the first timestamp in the dataset.

  Specified by:
    `getFirstTimestamp` in interface `RrdDataSet`
  Returns:
    The smallest timestamp.

### getLastTimestamp

    public long getLastTimestamp()

  Returns the last timestamp in the dataset.

  Specified by:
    `getLastTimestamp` in interface `RrdDataSet`
  Returns:
    The biggest timestamp.

### getDsNames

    public java.lang.String[] getDsNames()

  Returns array of the names of all datasources in the set.

  Specified by:
    `getDsNames` in interface `RrdDataSet`
  Returns:
    Array of datasource names.

### getDsIndex

    public int getDsIndex(java.lang.String dsName)
                   throws RrdException

  Retrieve the table index number of a datasource by name. Names are case sensitive.

  Specified by:
    `getDsIndex` in interface `RrdDataSet`
  Parameters:
    `dsName` - Name of the datasource for which to find the index.
  Returns:
    Index number of the datasource in the value table.
  Throws:
    `RrdException` - Thrown if the given datasource name cannot be found in the dataset.

### getAggregate

    public double getAggregate(java.lang.String dsName,
                               java.lang.String consolFun)
                        throws RrdException

  Returns aggregated value from the dataset for a single datasource.

  Specified by:
    `getAggregate` in interface `RrdDataSet`
  Parameters:
    `dsName` - Datasource name
    `consolFun` - Consolidation function to be applied to set datasource values datasource. Valid consolidation functions are MIN, MAX, LAST, FIRST, AVERAGE and TOTAL
  Returns:
    MIN, MAX, LAST, FIRST, AVERAGE or TOTAL value calculated from the dataset for the given datasource name
  Throws:
    `RrdException` - Thrown if the given datasource name cannot be found in the dataset.

### print

    public java.lang.String print(java.lang.String sourceName,
                                  java.lang.String consolFun,
                                  java.lang.String format)
                           throws RrdException

  Calculate the chosen consolidation function `consolFun` over the `sourceName` and returns the result as a string using the specified `format`.

  In the format string there should be a `@n.d` marker (replace `n` with the total number of spaces the value should at minimum take up, and replace `d` with the desired number of decimals) in the place where the number should be printed. If an additional `@s` is found in the format, the value will be scaled and an appropriate SI magnitude unit will be printed in place of the `@s` marker. If you specify `@S` instead of `@s`, the value will be scaled with the scale factor used in the last gprint directive (uniform value scaling).

  Parameters:
    `sourceName` - Source name
    `consolFun` - Consolidation function to be used for calculation ("AVERAGE", "MIN", "MAX", "LAST" or "TOTAL" (since 1.3.1)
    `format` - Format string. For example: "speed is @5.2 @sbits/sec@c", "temperature = @0 degrees"
  Throws:
    `RrdException` - Thrown in case of JRobin specific error

### print

    public java.lang.String print(java.lang.String sourceName,
                                  java.lang.String consolFun,
                                  java.lang.String format,
                                  double base)
                           throws RrdException

  Calculate the chosen consolidation function `consolFun` over the `sourceName` and returns the result as a string using the specified `format`.

  In the format string there should be a `@n.d` marker (replace `n` with the total number of spaces the value should at minimum take up, and replace `d` with the desired number of decimals) in the place where the number should be printed. If an additional `@s` is found in the format, the value will be scaled and an appropriate SI magnitude unit will be printed in place of the `@s` marker. If you specify `@S` instead of `@s`, the value will be scaled with the scale factor used in the last gprint directive (uniform value scaling).

  Parameters:
    `sourceName` - Source name
    `consolFun` - Consolidation function to be used for calculation ("AVERAGE", "MIN", "MAX", "LAST" or "TOTAL" (since 1.3.1)
    `format` - Format string. For example: "speed is @5.2 @sbits/sec@c", "temperature = @0 degrees"
    `base` - Base value used to calculate the appriopriate scaling SI magnitude.
  Throws:
    `RrdException` - Thrown in case of JRobin specific error

### importXml

    public void importXml(java.lang.String xportXml)
                   throws RrdException,
                          java.io.IOException

  Imports a export XML string and maps it back to this ExportData object. The XML can be from either a JRobin or RRDtool export. Datasources found will be named d1, d2, ...

  Parameters:
    `xportXml` - String containing the XML result of an export.
  Throws:
    `RrdException`
    `java.io.IOException`

### importXml

    public void importXml(java.io.File xmlFile)
                   throws RrdException,
                          java.io.IOException

  Imports a export XML string and maps it back to this ExportData object. The XML can be from either a JRobin or RRDtool export. Datasources found will be named d1, d2, ...

  Parameters:
    `xmlFile` - File containing export XML dump.
  Throws:
    `RrdException`
    `java.io.IOException`

### importXml

    public void importXml(java.io.File xmlFile,
                          boolean useLegendNames)
                   throws RrdException,
                          java.io.IOException

  Imports a export XML string and maps it back to this ExportData object. The XML can be from either a JRobin or RRDtool export. The name of the datasources found will depend on the 'useLegendNames' flag.

  Parameters:
    `xmlFile` - File containing export XML dump.
    `useLegendNames` - True if the names for the datasources should be set to the legend values, false if they should be d1, d2, ...
  Throws:
    `RrdException`
    `java.io.IOException`

### importXml

    public void importXml(java.lang.String xportXml,
                          java.lang.String dsNamePrefix)
                   throws RrdException,
                          java.io.IOException

  Imports a export XML string and maps it back to this ExportData object. The XML can be from either a JRobin or RRDtool export. The name of the datasources found will be the prefix passed as parameter, followed by a number, making the name unique.

  Parameters:
    `xportXml` - String containing the XML result of an export.
    `dsNamePrefix` - Prefix of the datasource names.
  Throws:
    `RrdException`
    `java.io.IOException`

### importXml

    public void importXml(java.io.File xmlFile,
                          java.lang.String dsNamePrefix)
                   throws RrdException,
                          java.io.IOException

  Imports a export XML string and maps it back to this ExportData object. The XML can be from either a JRobin or RRDtool export. The name of the datasources found will be the prefix passed as parameter, followed by a number, making the name unique.

  Parameters:
    `xmlFile` - File containing export XML dump.
    `dsNamePrefix` - Prefix of the datasource names.
  Throws:
    `RrdException`
    `java.io.IOException`

### importXml

    public void importXml(java.lang.String xportXml,
                          boolean useLegendNames)
                   throws RrdException,
                          java.io.IOException

  Imports a export XML string and maps it back to this ExportData object. The XML can be from either a JRobin or RRDtool export. The name of the datasources found will depend on the 'useLegendNames' flag.

  Parameters:
    `xportXml` - String containing the XML result of an export.
    `useLegendNames` - True if the names for the datasources should be set to the legend values, false if they should be d1, d2, ...
  Throws:
    `RrdException`
    `java.io.IOException`

### exportXml

    public void exportXml(java.io.OutputStream outputStream)
                   throws RrdException,
                          java.io.IOException

  Dumps fetch data to output stream in XML format.

  Specified by:
    `exportXml` in interface `RrdDataSet`
  Parameters:
    `outputStream` - Output stream to dump dataset to
  Throws:
    `RrdException` - Thrown in case of JRobin specific error.
    `java.io.IOException` - Thrown in case of I/O error

### exportXml

    public void exportXml(java.lang.String filepath)
                   throws RrdException,
                          java.io.IOException

  Dumps dataset to file in XML format.

  Specified by:
    `exportXml` in interface `RrdDataSet`
  Parameters:
    `filepath` - Path to destination file
  Throws:
    `RrdException` - Thrown in case of JRobin specific error.
    `java.io.IOException` - Thrown in case of I/O error

### exportXml

    public java.lang.String exportXml()
                               throws RrdException,
                                      java.io.IOException

  Dumps the dataset to XML.

  Specified by:
    `exportXml` in interface `RrdDataSet`
  Returns:
    XML string format of the dataset.
  Throws:
    `RrdException` - Thrown in case of JRobin specific error.
    `java.io.IOException` - Thrown in case of an I/O related error.

### getSources

    protected org.jrobin.graph.Source[] getSources()