/** * Returns an array of all datasource values for all datasources. Each row in this two-dimensional * array represents an array of calculated values for a single datasource. The order of rows is the same * as the order in which datasources were added to this DataProcessor object. * * @return All datasource values for all datasources. The first index is the index of the datasource, * the second index is the index of the datasource value. The number of datasource values is equal * to the number of timestamps returned with {@link #getTimestamps()} method. * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public double[][] getValues() throws RrdException { String[] names = getSourceNames(); double[][] values = new double[names.length][]; for (int i = 0; i < names.length; i++) { values[i] = getValues(names[i]); } return values; }
/** * Dumps timestamps and values of all datasources in a tabelar form. Very useful for debugging. * * @return Dumped object content. * @throws RrdException Thrown if nothing is calculated so far (the method {@link #processData()} * was not called). */ public String dump() throws RrdException { String[] names = getSourceNames(); double[][] values = getValues(); StringBuilder buffer = new StringBuilder(); buffer.append(format("timestamp", 12)); for (String name : names) { buffer.append(format(name, 20)); } buffer.append("\n"); for (int i = 0; i < timestamps.length; i++) { buffer.append(format("" + timestamps[i], 12)); for (int j = 0; j < names.length; j++) { buffer.append(format(Util.formatDouble(values[j][i]), 20)); } buffer.append("\n"); } return buffer.toString(); }
/** * Returns an array of all datasource values for all datasources. Each row in this two-dimensional * array represents an array of calculated values for a single datasource. The order of rows is the same * as the order in which datasources were added to this DataProcessor object. * * @return All datasource values for all datasources. The first index is the index of the datasource, * the second index is the index of the datasource value. The number of datasource values is equal * to the number of timestamps returned with {@link #getTimestamps()} method. * @throws RrdException Thrown if invalid datasource name is specified, * or if datasource values are not yet calculated (method {@link #processData()} * was not called) */ public double[][] getValues() throws RrdException { String[] names = getSourceNames(); double[][] values = new double[names.length][]; for (int i = 0; i < names.length; i++) { values[i] = getValues(names[i]); } return values; }
/** * Dumps timestamps and values of all datasources in a tabelar form. Very useful for debugging. * * @return Dumped object content. * @throws RrdException Thrown if nothing is calculated so far (the method {@link #processData()} * was not called). */ public String dump() throws RrdException { String[] names = getSourceNames(); double[][] values = getValues(); StringBuffer buffer = new StringBuffer(); buffer.append(format("timestamp", 12)); for (String name : names) { buffer.append(format(name, 20)); } buffer.append("\n"); for (int i = 0; i < timestamps.length; i++) { buffer.append(format("" + timestamps[i], 12)); for (int j = 0; j < names.length; j++) { buffer.append(format(Util.formatDouble(values[j][i]), 20)); } buffer.append("\n"); } return buffer.toString(); }