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 <geoffroy.jamgotchian at rte-france.com>
  • Method Details

    • 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)