java.lang.Object
org.rrd4j.core.jrrd.DataChunk
Models a chunk of result data from an RRDatabase.
Field Summary
FieldsModifier and TypeFieldDescription(package private) final double[][]The data values(package private) final intNumber of datasources must be equal to number of datasources in file(package private) final intRow number offset relative to current rowMap datasource name to datasource indexprivate static final StringLine separator of the text formprivate final intNumber of rows in the chunk.(package private) final intRow number offset relative to current row.private final longStart time in seconds since epochprivate final longStep in secondsConstructor Summary
ConstructorsConstructorDescriptionDataChunk(Map<String, Integer> nameindex, long startTime, int startOffset, int endOffset, long step, int dsCount, int rows) Creates an empty chunk of fetched data, allocating the value grid thatArchive.loadData(RRDFile, int)then fills in with one row per archived time step and one column per datasource.Method Summary
All MethodsModifier and TypeMethodDescriptiondouble[][]getData()Getter for the fielddata.intReturns the number of datasources held per row.intgetEnd()Returns the row offset just past this chunk's last row.intgetStart()Returns the row offset of this chunk's first row.longgetStep()Returns the seconds between consecutive rows in this chunk.long[]Getter for the time stamps values.toPlottable(String name) Extract a datasource from the datachunck given is name as a PlottabletoString()Returns a summary of the contents of this data chunk.
Field Details
NEWLINE
Line separator of the text formstartTime
private final long startTimeStart time in seconds since epochstartOffset
final int startOffsetRow number offset relative to current row. Can be negativeendOffset
final int endOffsetRow number offset relative to current rowstep
private final long stepStep in secondsdsCount
final int dsCountNumber of datasources must be equal to number of datasources in filedata
final double[][] dataThe data valuesrows
private final int rowsNumber of rows in the chunk.nameindex
Constructor Details
DataChunk
DataChunk(Map<String, Integer> nameindex, long startTime, int startOffset, int endOffset, long step, int dsCount, int rows) Creates an empty chunk of fetched data, allocating the value grid thatArchive.loadData(RRDFile, int)then fills in with one row per archived time step and one column per datasource.- Parameters:
nameindex- datasource name to column index, used to locate a named datasource within the value gridstartTime- timestamp in seconds since the epoch of the chunk's first row, rounded down to a whole number of stepsstartOffset- row number of the first row, relative to the archive's current row; negative when the requested range starts before the archive's oldest rowendOffset- row number one past the chunk's last row, relative to the archive's current row; negative for a range ending before itstep- seconds between consecutive rowsdsCount- number of datasources, which must match the datasource count recorded in the RRD filerows- number of rows to allocate, one per step spanning the range
Method Details
toString
getStart
public int getStart()Returns the row offset of this chunk's first row.- Returns:
- the row number offset of this chunk's first row, relative to the current row
getEnd
public int getEnd()Returns the row offset just past this chunk's last row.- Returns:
- the row number offset just past this chunk's last row, relative to the current row
getStep
public long getStep()Returns the seconds between consecutive rows in this chunk.- Returns:
- the number of seconds between consecutive rows in this chunk
getDsCount
public int getDsCount()Returns the number of datasources held per row.- Returns:
- the number of datasources held per row in this chunk
getData
public double[][] getData()Getter for the fielddata.- Returns:
- the stored values, one row per timestamp
getTimestamps
public long[] getTimestamps()Getter for the time stamps values.- Returns:
- array of time stamps in seconds
toPlottable
Extract a datasource from the datachunck given is name as a Plottable- Parameters:
name- the datasource name- Returns:
- a plottable for the datasource