Package com.powsybl.timeseries
Interface DataChunk<P extends AbstractPoint,A extends DataChunk<P,A>>
-
- All Known Subinterfaces:
DoubleDataChunk
,StringDataChunk
- All Known Implementing Classes:
CompressedDoubleDataChunk
,CompressedStringDataChunk
,UncompressedDoubleDataChunk
,UncompressedStringDataChunk
public interface DataChunk<P extends AbstractPoint,A extends DataChunk<P,A>>
- Author:
- Geoffroy Jamgotchian
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DataChunk.JsonParsingContext
static class
DataChunk.Split<P extends AbstractPoint,A extends DataChunk<P,A>>
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static void
addCompressedChunk(DataChunk.JsonParsingContext context)
static void
addUncompressedChunk(DataChunk.JsonParsingContext context)
A
append(A otherChunk)
Append the chunk with the one given in argument, and return the result.static DoubleDataChunk
create(double... values)
static DoubleDataChunk
create(int offset, double[] values)
static StringDataChunk
create(int offset, String[] values)
static StringDataChunk
create(String... values)
double
getCompressionFactor()
Get compression factor. 1 means no compression.TimeSeriesDataType
getDataType()
Get data type.int
getEstimatedSize()
Get estimated size in bytes.int
getLength()
Get data chunk lengthint
getOffset()
Get data chunk offset.boolean
isCompressed()
Check if chunk is in compressed form.Iterator<P>
iterator(TimeSeriesIndex index)
Get a point iterator.static void
parseEndObject(DataChunk.JsonParsingContext context)
static void
parseFieldName(com.fasterxml.jackson.core.JsonParser parser, DataChunk.JsonParsingContext context)
static void
parseJson(com.fasterxml.jackson.core.JsonParser parser, List<DoubleDataChunk> doubleChunks, List<StringDataChunk> stringChunks)
static void
parseJson(com.fasterxml.jackson.core.JsonParser parser, List<DoubleDataChunk> doubleChunks, List<StringDataChunk> stringChunks, boolean single)
static void
parseValueNumberInt(com.fasterxml.jackson.core.JsonParser parser, DataChunk.JsonParsingContext context)
DataChunk.Split<P,A>
splitAt(int splitIndex)
Split the chunk in two parts.Stream<P>
stream(TimeSeriesIndex index)
Get a point stream.String
toJson()
A
tryToCompress()
Try to compress the chunk.void
writeJson(com.fasterxml.jackson.core.JsonGenerator generator)
Serialize this data chunk to json.static void
writeJson(com.fasterxml.jackson.core.JsonGenerator generator, List<? extends DataChunk> chunks)
Serialize a chunk list to json
-
-
-
Method Detail
-
getOffset
int getOffset()
Get data chunk offset.- Returns:
- data chunk offset
-
getLength
int getLength()
Get data chunk length- Returns:
- data chunk length
-
getEstimatedSize
int getEstimatedSize()
Get estimated size in bytes.- Returns:
- estimated size in bytes
-
getCompressionFactor
double getCompressionFactor()
Get compression factor. 1 means no compression.- Returns:
- the compression factor
-
isCompressed
boolean isCompressed()
Check if chunk is in compressed form.- Returns:
- true if chunk is in compressed form, false otherwise
-
getDataType
TimeSeriesDataType getDataType()
Get data type.- Returns:
- the data type
-
stream
Stream<P> stream(TimeSeriesIndex index)
Get a point stream.- Parameters:
index
- the time series index- Returns:
- a point stream
-
iterator
Iterator<P> iterator(TimeSeriesIndex index)
Get a point iterator.- Parameters:
index
- the time series index- Returns:
- a point iterator
-
tryToCompress
A tryToCompress()
Try to compress the chunk.- Returns:
- the compressed chunk or itself if compression is not efficient enough
-
splitAt
DataChunk.Split<P,A> splitAt(int splitIndex)
Split the chunk in two parts.- Parameters:
splitIndex
- the split index- Returns:
- both chunks
-
append
A append(A otherChunk)
Append the chunk with the one given in argument, and return the result. "This" dataChunk and the one in argument remain unchanged. The two chunks have to be successive, i.e : this.getOffset() + this.length() = otherChunk.getOffset()- Parameters:
otherChunk
- : the chunk to append with this object. It has to be the same implementation as this object.- Returns:
-
writeJson
void writeJson(com.fasterxml.jackson.core.JsonGenerator generator)
Serialize this data chunk to json.- Parameters:
generator
- a json generator (jackson)- Throws:
IOException
- in case of json writing error
-
create
static DoubleDataChunk create(int offset, double[] values)
-
create
static DoubleDataChunk create(double... values)
-
create
static StringDataChunk create(int offset, String[] values)
-
create
static StringDataChunk create(String... values)
-
writeJson
static void writeJson(com.fasterxml.jackson.core.JsonGenerator generator, List<? extends DataChunk> chunks)
Serialize a chunk list to json- Parameters:
generator
- a json generator (jackson)chunks
- the chunk list
-
toJson
String toJson()
-
parseFieldName
static void parseFieldName(com.fasterxml.jackson.core.JsonParser parser, DataChunk.JsonParsingContext context) throws IOException
- Throws:
IOException
-
addUncompressedChunk
static void addUncompressedChunk(DataChunk.JsonParsingContext context)
-
addCompressedChunk
static void addCompressedChunk(DataChunk.JsonParsingContext context)
-
parseEndObject
static void parseEndObject(DataChunk.JsonParsingContext context)
-
parseValueNumberInt
static void parseValueNumberInt(com.fasterxml.jackson.core.JsonParser parser, DataChunk.JsonParsingContext context) throws IOException
- Throws:
IOException
-
parseJson
static void parseJson(com.fasterxml.jackson.core.JsonParser parser, List<DoubleDataChunk> doubleChunks, List<StringDataChunk> stringChunks)
-
parseJson
static void parseJson(com.fasterxml.jackson.core.JsonParser parser, List<DoubleDataChunk> doubleChunks, List<StringDataChunk> stringChunks, boolean single)
-
-