|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--rrd.Rrd.FetchData
Inner class to hold information returned by Rrd.fetch()
.
Logically, this information represents one simple table. Here is the example:
timestamp temperature1 temperature2 ========================================== 1000000000 36.2 66.9 1000005000 39.3 69.2 1000010000 40.0 68.3 .......... .... .... 1001000000 39.6 66.7 ==========================================To read this data use the following methods:
getRowCount()
to find the number of rows
getColCount()
to find the number of data columns
getColName()
to find the name of the i-th data column (zero based)
getTimestamp(i)
to find the timestamp of the i-th row (zero based)
getValue(i, j)
to find the value of the j-th data column on the i-th row
Example:
String cmd = "fetch temperatures.rrd AVERAGE --start 1000000000 --end 1000086400"; rrd.Rrd.FetchData data = Rrd.getInstance().fetch(cmd); int rows = data.getRowCount(), cols = data.getColCount(); for(int i = 0; i < rows; i++) { System.out.print(i + ": t=" + data.getTimestamp(i) + " "); for(int j = 0; j < cols; j++) { System.out.print(data.getColName(j) + "=" + data.getValue(i, j) + " "); } System.out.println(); }
Method Summary | |
int |
getColCount()
Returns number of columns (data sources) generated by Rrd.fetch() method. |
java.lang.String |
getColName(int col)
Returns column (data source) name for the given column number |
int |
getRowCount()
Returns number of rows generated by Rrd.fetch() method. |
long |
getTimestamp(int row)
Returns timestamp of the given row. |
double |
getValue(int row,
int col)
Returns data source value from RRD database. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public long getTimestamp(int row)
row
- Zero-based row number
public double getValue(int row, int col)
row
- Zero-based row number.col
- Zero based data column number.
public java.lang.String getColName(int col)
col
- Zero-based column number.
public int getColCount()
Rrd.fetch()
method.
public int getRowCount()
Rrd.fetch()
method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |