java.lang.Object
org.rrd4j.core.RrdPrimitive<U>
org.rrd4j.core.RrdDoubleMatrix<U>
- Type Parameters:
U- The type of RrdUpdater this primitive belongs to
RRD primitive type for handling matrices of double values.
This class provides methods to store and retrieve two-dimensional matrices of double values in RRD files. It organizes data in a row-column format and provides efficient access to individual elements and ranges.
Field Summary
Fields inherited from class RrdPrimitive
RRD_DOUBLE, RRD_INT, RRD_LONG, RRD_PRIM_SIZES, RRD_STRING, STRING_LENGTHModifier and TypeFieldDescription(package private) static final intType identifier for double RRD primitives.(package private) static final intType identifier for integer RRD primitives.(package private) static final intType identifier for long RRD primitives.(package private) static final int[]Array containing the size in bytes for each RRD primitive type.(package private) static final intType identifier for string RRD primitives.(package private) static final intMaximum length of string values stored in RRD primitives.Constructor Summary
ConstructorsConstructorDescriptionRrdDoubleMatrix(RrdUpdater<U> updater, int row, int column, boolean shouldInitialize) Allocate a row x column matrix of doubles in the updater's backend storage.Method Summary
All MethodsModifier and TypeMethodDescription(package private) doubleget(int column, int index) Reads one value from the given matrix position.(package private) double[]get(int column, int index, int count) Reads a run of values from one column, one per consecutive row.intReturn how many columns the matrix holds.intgetRows()Return how many rows the matrix holds.(package private) voidset(int column, int index, double value) Stores one value at the given matrix position.voidset(int column, int index, double[] newValues) Stores a column of values, one per consecutive row.(package private) voidset(int column, int index, double value, int count) Stores one value in each of the next count rows of a column.Methods inherited from class RrdPrimitive
isCachingAllowed, readBytes, readDouble, readDouble, readDouble, readEnum, readInt, readLong, readString, writeBytes, writeDouble, writeDouble, writeDouble, writeDouble, writeEnum, writeInt, writeLong, writeStringModifier and TypeMethodDescription(package private) final booleanChecks if caching is allowed for this primitive.(package private) final byte[]Raw byte array from backend storage.(package private) final doubleDouble value from backend storage.(package private) final doublereadDouble(int index) Position in the primitive array.(package private) final double[]readDouble(int index, int count) Starting position in the primitive array.protected final <E extends Enum<E>>
EDeserialize an enum value from backend storage.(package private) final intreadInt()Int value from backend storage.(package private) final longreadLong()Long value from backend storage.(package private) final StringString value from backend storage.(package private) final voidwriteBytes(byte[] b) Byte array to write to backend storage.(package private) final voidwriteDouble(double value) Double value to write to backend storage.(package private) final voidwriteDouble(int index, double value) Position in the primitive array.(package private) final voidwriteDouble(int index, double[] values) Starting position in the primitive array.(package private) final voidwriteDouble(int index, double value, int count) Starting position in the primitive array.protected final <E extends Enum<E>>
voidwriteEnum(E value) Serialize an enum value to backend storage.(package private) final voidwriteInt(int value) Int value to write to backend storage.(package private) final voidwriteLong(long value) Long value to write to backend storage.(package private) final voidwriteString(String value) String value to write to backend storage.
Constructor Details
RrdDoubleMatrix
RrdDoubleMatrix(RrdUpdater<U> updater, int row, int column, boolean shouldInitialize) throws IOException Allocate a row x column matrix of doubles in the updater's backend storage.- Parameters:
updater- the updater whose allocator and backend back this primitiverow- the number of rows in the matrixcolumn- the number of columns in the matrixshouldInitialize- if true, fill every slot with NaN before returning- Throws:
IOException- if the backend storage cannot be written
Method Details
set
Stores one value at the given matrix position.- Parameters:
column- the zero-based column indexindex- the zero-based row indexvalue- the double to store at that position- Throws:
IOException- if the backend storage cannot be written
set
Stores one value in each of the next count rows of a column.- Parameters:
column- the zero-based column indexindex- the zero-based row index at which to start writingvalue- the double to store at each of the count positionscount- how many consecutive rows to write; index plus count may not exceed the row count- Throws:
IOException- if the backend storage cannot be written
set
Stores a column of values, one per consecutive row.- Parameters:
column- the zero-based column indexindex- the zero-based row index at which to start writingnewValues- the doubles to store, in increasing row order- Throws:
IOException- if the backend storage cannot be written
get
Reads one value from the given matrix position.- Parameters:
column- the zero-based column indexindex- the zero-based row index, which must be less than the row count- Returns:
- the double stored at that position
- Throws:
IOException- if the backend storage cannot be read
get
Reads a run of values from one column, one per consecutive row.- Parameters:
column- the zero-based column indexindex- the zero-based row index at which to start readingcount- how many consecutive rows to read; index plus count may not exceed the row count- Returns:
- the count values read, in increasing row order
- Throws:
IOException- if the backend storage cannot be read
getColumns
public int getColumns()Return how many columns the matrix holds.- Returns:
- number of columns
getRows
public int getRows()Return how many rows the matrix holds.- Returns:
- number of rows