Class BufferChunkDoubleNullable

    • Constructor Detail

      • BufferChunkDoubleNullable

        public BufferChunkDoubleNullable()
        Empty constructor (for serialization purpose).
      • BufferChunkDoubleNullable

        public BufferChunkDoubleNullable​(int chunkSize,
                                         IBufferAllocator allocator)
        Constructor.
        Parameters:
        chunkSize - The size of the chunk to allocate (the number of doubles it can store).
        allocator - The allocator to use to create the underlying ByteBuffer responsible for storing the underlying data.
    • Method Detail

      • isNull

        public boolean isNull​(int position)
        Description copied from class: BufferChunkDouble
        Always returns false because this chunk cannot store null values.
        Specified by:
        isNull in interface IArrayReader
        Overrides:
        isNull in class BufferChunkDouble
        Parameters:
        position - 0-based index in an array
        Returns:
        false because this chunk cannot store null values
      • read

        public Double read​(int position)
        Description copied from interface: IChunk
        Returns the data stored at that position in the chunk.
        Specified by:
        read in interface IArrayReader
        Specified by:
        read in interface IChunk<Double>
        Specified by:
        read in interface IChunkDouble
        Overrides:
        read in class BufferChunkDouble
        Parameters:
        position - the position in the chunk at which to read
        Returns:
        the data stored at that position in the chunk
      • write

        public void write​(int position,
                          Object value)
        Description copied from interface: IArrayWriter
        Writes a piece of data at a position in the array.

        For better performance, use the primitive type operations.

        Specified by:
        write in interface IArrayWriter
        Specified by:
        write in interface IChunkDouble
        Overrides:
        write in class BufferChunkDouble
        Parameters:
        position - 0-based index in the array
        value - the value to write
      • addDouble

        public void addDouble​(int position,
                              double addedValue)
        Description copied from interface: IArrayWriter
        Adds a double primitive value to an element of the array.
        Specified by:
        addDouble in interface IArrayWriter
        Overrides:
        addDouble in class BufferChunkDouble
        Parameters:
        position - 0-based index in the array
        addedValue - the value to add
      • transfer

        public void transfer​(IWritableTable destination,
                             int destinationColumn,
                             int[] rowsMapping,
                             int numRows)
        Description copied from interface: IChunk
        Transfers a given number of rows from this chunk to target rows in the given column of the destination table.

        The mapping from the source rows to the target rows is described with an array of 2*n slots. Each even slot contains the index of the row to be copied from the source chunk and the following odd slot contains the index of the row into which the source data will be transferred.

        Specified by:
        transfer in interface IChunk<Double>
        Specified by:
        transfer in interface IChunkDouble
        Overrides:
        transfer in class BufferChunkDouble
        Parameters:
        destination - the destination table
        destinationColumn - the column to transfer the data to in the destination table
        rowsMapping - the mapping from source rows to target rows, as explained above
        numRows - the number of rows to transfer
      • copyInto

        public void copyInto​(int position,
                             IWritableCell cell)
        Description copied from interface: IChunk
        Copies the value at a given position in this chunk into the provided cell.
        Specified by:
        copyInto in interface IChunk<Double>
        Specified by:
        copyInto in interface IChunkDouble
        Parameters:
        position - row of the chunk to read
      • writeFromCell

        public void writeFromCell​(int position,
                                  IReadableCell cell)
        Description copied from interface: IChunk
        Writes the content of the cell into the chunk at the given position.

        It is up to chunks to use the appropriate read method to avoid boxing as much as possible.

        Specified by:
        writeFromCell in interface IChunk<Double>
        Specified by:
        writeFromCell in interface IChunkDouble
      • destroy

        public Runnable destroy()
        Description copied from interface: IChunk
        Equivalent to a finalizer for this chunk, but that can be called by the application when it is certain that the chunk will not be used or even reached anymore.

        Chunk implementations can use this opportunity to dereference objects, or even free memory in the case of direct memory chunks. For that reason it is unsafe to call destroy() and it is possible to crash the JVM if the chunk is accessed after its memory has been reclaimed.

        Most often this Runnable is registered to IActiveCollector.register(Runnable) to make sure that the destruction is safe.

        Specified by:
        destroy in interface IChunk<Double>
        Overrides:
        destroy in class BufferChunkDouble
        Returns:
        the Runnable to run to actually free the data
      • fill

        public void fill​(double value)
        Description copied from interface: IChunkDouble
        Fills all slots in the chunk with the same value.
        Specified by:
        fill in interface IChunkDouble
        Overrides:
        fill in class BufferChunkDouble
        Parameters:
        value - the value to fill the chunk with
      • findRowsEqualTo

        public void findRowsEqualTo​(Object value,
                                    long epoch,
                                    IChunkLong version,
                                    int chunkBase,
                                    int chunkLimit,
                                    IRowMapping mapping,
                                    int limit,
                                    IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with the sought object in the chunk.
        Specified by:
        findRowsEqualTo in interface IChunk<Double>
        Overrides:
        findRowsEqualTo in class BufferChunkDouble
        Parameters:
        value - the sought object
        epoch - the epoch will define which rows are read. Only rows created before or deleted after this epoch will be read
        version - the column holding the version number at which each row has been inserted or removed
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        chunkLimit - the number of rows to iterate in this chunk, it should not be bigger than the chunk size
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with the sought object
      • findRowsEqualTo

        public void findRowsEqualTo​(Object value,
                                    int chunkBase,
                                    int chunkLimit,
                                    IRowMapping mapping,
                                    int limit,
                                    IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with the sought object in the chunk.
        Specified by:
        findRowsEqualTo in interface IChunk<Double>
        Overrides:
        findRowsEqualTo in class BufferChunkDouble
        Parameters:
        value - the sought object
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        chunkLimit - the number of rows to iterate in this chunk, it should not be bigger than the chunk size
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with the sought object
      • findRowsEqualTo

        public void findRowsEqualTo​(Object value,
                                    IIntIterator filter,
                                    int chunkBase,
                                    IRowMapping mapping,
                                    int limit,
                                    IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with the sought object in the chunk.
        Specified by:
        findRowsEqualTo in interface IChunk<Double>
        Overrides:
        findRowsEqualTo in class BufferChunkDouble
        Parameters:
        value - the sought object
        filter - all the row numbers that should be considered for this research
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with the sought object
      • findRowsInSet

        public void findRowsInSet​(Set<Object> values,
                                  long epoch,
                                  IChunkLong version,
                                  int chunkBase,
                                  int chunkLimit,
                                  IRowMapping mapping,
                                  int limit,
                                  IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.
        Specified by:
        findRowsInSet in interface IChunk<Double>
        Overrides:
        findRowsInSet in class BufferChunkDouble
        Parameters:
        values - the set of sought objects
        epoch - the epoch will define which rows are read, only rows created before or deleted after this epoch will be read
        version - the column holding the version number at which each row has been inserted or removed
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        chunkLimit - the number of rows to iterate in this chunk, it should not be bigger than the chunk size
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with any object in the set of sought objects
      • findRowsInSet

        public void findRowsInSet​(Set<Object> values,
                                  int chunkBase,
                                  int chunkLimit,
                                  IRowMapping mapping,
                                  int limit,
                                  IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.
        Specified by:
        findRowsInSet in interface IChunk<Double>
        Overrides:
        findRowsInSet in class BufferChunkDouble
        Parameters:
        values - the set of sought objects
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        chunkLimit - the number of rows to iterate in this chunk, it should not be bigger than the chunk size
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with any object in the set of sought objects
      • findRowsInSet

        public void findRowsInSet​(Set<Object> values,
                                  IIntIterator filter,
                                  int chunkBase,
                                  IRowMapping mapping,
                                  int limit,
                                  IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.
        Specified by:
        findRowsInSet in interface IChunk<Double>
        Overrides:
        findRowsInSet in class BufferChunkDouble
        Parameters:
        values - the set of sought objects
        filter - all the row numbers that should be considered for this research
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with any object in the set of sought objects
      • findRowsInTransactionEqualTo

        public void findRowsInTransactionEqualTo​(Object value,
                                                 IChunkLong version,
                                                 int chunkBase,
                                                 int chunkLimit,
                                                 IRowMapping mapping,
                                                 int limit,
                                                 IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with the sought object in the chunk.
        Specified by:
        findRowsInTransactionEqualTo in interface IChunk<Double>
        Overrides:
        findRowsInTransactionEqualTo in class BufferChunkDouble
        Parameters:
        value - the sought object
        version - the column holding the version number at which each row has been inserted or removed corresponding to this chunk
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        chunkLimit - the number of rows to iterate in this chunk, it should not be bigger than the chunk size
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with the sought object
      • findRowsInTransactionEqualTo

        public void findRowsInTransactionEqualTo​(Object value,
                                                 IChunkLong version,
                                                 IBitmap deletions,
                                                 int chunkBase,
                                                 int chunkLimit,
                                                 IRowMapping mapping,
                                                 int limit,
                                                 IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with the sought object in the chunk.
        Specified by:
        findRowsInTransactionEqualTo in interface IChunk<Double>
        Overrides:
        findRowsInTransactionEqualTo in class BufferChunkDouble
        Parameters:
        value - the sought object
        version - the column holding the version number at which each row has been inserted or removed corresponding to this chunk
        deletions - a bitmap of deleted rows, that should not be scanned
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        chunkLimit - the number of rows to iterate in this chunk, it should not be bigger than the chunk size
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with the sought object
      • findRowsInTransactionEqualTo

        public void findRowsInTransactionEqualTo​(Object value,
                                                 IIntIterator filter,
                                                 IBitmap deletions,
                                                 int chunkBase,
                                                 IRowMapping mapping,
                                                 int limit,
                                                 IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with the sought object in the chunk.
        Specified by:
        findRowsInTransactionEqualTo in interface IChunk<Double>
        Overrides:
        findRowsInTransactionEqualTo in class BufferChunkDouble
        Parameters:
        value - the sought object
        filter - all the row numbers that should be considered for this research
        deletions - a bitmap of deleted rows, that should not be scanned
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with the sought object
      • findRowsInTransactionInSet

        public void findRowsInTransactionInSet​(Set<Object> values,
                                               IChunkLong version,
                                               int chunkBase,
                                               int chunkLimit,
                                               IRowMapping mapping,
                                               int limit,
                                               IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.
        Specified by:
        findRowsInTransactionInSet in interface IChunk<Double>
        Overrides:
        findRowsInTransactionInSet in class BufferChunkDouble
        Parameters:
        values - the set of sought objects
        version - the column holding the version number at which each row has been inserted or removed corresponding to this chunk
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        chunkLimit - the number of rows to iterate in this chunk, it should not be bigger than the chunk size
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with any object in the set of sought objects
      • findRowsInTransactionInSet

        public void findRowsInTransactionInSet​(Set<Object> values,
                                               IChunkLong version,
                                               IBitmap deletions,
                                               int chunkBase,
                                               int chunkLimit,
                                               IRowMapping mapping,
                                               int limit,
                                               IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.
        Specified by:
        findRowsInTransactionInSet in interface IChunk<Double>
        Overrides:
        findRowsInTransactionInSet in class BufferChunkDouble
        Parameters:
        values - the set of sought objects
        version - the column holding the version number at which each row has been inserted or removed corresponding to this chunk
        deletions - a bitmap of deleted rows, that should not be scanned
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        chunkLimit - the number of rows to iterate in this chunk, it should not be bigger than the chunk size
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with any object in the set of sought objects
      • findRowsInTransactionInSet

        public void findRowsInTransactionInSet​(Set<Object> values,
                                               IIntIterator filter,
                                               IBitmap deletions,
                                               int chunkBase,
                                               IRowMapping mapping,
                                               int limit,
                                               IBitmap result)
        Description copied from interface: IChunk
        Scans all the records and returns all the rows matching with any object in the set of sought objects in the chunk.
        Specified by:
        findRowsInTransactionInSet in interface IChunk<Double>
        Overrides:
        findRowsInTransactionInSet in class BufferChunkDouble
        Parameters:
        values - the set of sought objects
        filter - all the row numbers that should be considered for this research
        deletions - a bitmap of deleted rows, that should not be scanned
        chunkBase - the offset in the result, the offset is the row number in the store corresponding to the first row in this chunk
        mapping - this mapping is only used when this chunk is a SparseChunk, and it is a map of the global row chunk to the underlying chunk, otherwise is null
        limit - the size limit for the result of this search, it can be 0 for a non limit size result
        result - a bitmap to add the row numbers matching with any object in the set of sought objects
      • replaceBy

        public Runnable replaceBy​(IChunk<?> replacement)
        Description copied from interface: IChunk
        Returns the destructor to run when this chunk is replaced by the given chunk.
        Specified by:
        replaceBy in interface IChunk<Double>
        Parameters:
        replacement - the new chunk, that replaces this chunks
        Returns:
        the destructor to run when this chunk is replaced by the given chunk
      • compress

        public IChunk<Double> compress​(IRowMapping mapping,
                                       int[] arrayMapping,
                                       int newChunkSize,
                                       IChunkFactory<Double> defaultChunkCreator)
        Description copied from interface: IChunk
        Creates a compressed chunk from this chunk, using only the rows given in the mapping. The mapping is given in different representations :
        • The mapping as an IRowMapping from the rows of the externally visible chunk to those of the compressed chunk. This representation corresponds to the mapping used in SparseChunk
        • The arrayMapping as an array of 2*n slots. This representation corresponds to the mapping used in IChunkBinding.transfer(int[], int). Each even slot contains the index of the row to be copied from this chunk and the following odd slot contains the index of the row into which the data will be in the compressed chunk.

        Note that the two representations of the mapping can seem inconsistent, in case we are recompressing the underlying chunk of a sparse chunk (the IRowMapping maps the externally visible rows to the rows of the future underlying of the future re-compressed chunk, while the arrayMapping maps the rows of current underlying chunk to the future underlying of re-compressed chunk).

        Specified by:
        compress in interface IChunk<Double>
        Overrides:
        compress in class BufferChunkDouble
        Parameters:
        mapping - the mapping from the rows of the externally visible chunk to those of the compressed chunk
        arrayMapping - the array representation of the mapping
        newChunkSize - the size of the chunk we want to create
        defaultChunkCreator - the chunk creator for a "normal" chunk (if this chunks knows of a better way to sparse itself, it can use it)
        Returns:
        a compressed chunk containing the copied data from this chunk
      • compressAsNotNullable

        public IChunk<Double> compressAsNotNullable​(IRowMapping mapping,
                                                    int[] arrayMapping,
                                                    int newChunkSize,
                                                    IChunkFactory<Double> defaultChunkCreator)
        Description copied from interface: IChunkNullable
        Compresses the chunk knowing there are not any null in the chunk.
        Specified by:
        compressAsNotNullable in interface IChunkNullable<Double>
        Parameters:
        mapping - the mapping from the rows of this chunk to those of the compressed chunk (or null if we compress all rows)
        arrayMapping - the array representation of the mapping (or null if we compress all rows)
        newChunkSize - the size of the chunk we want to create
        defaultChunkCreator - the chunk creator for a "normal" chunk (if this chunks knows of a better way to sparse itself, it can use it)
        Returns:
        the compressed chunk
      • destroyNullFlags

        public Runnable destroyNullFlags()
        Description copied from interface: IChunkNullable
        Returns the runnable to run to destroy the nullable flags.
        Specified by:
        destroyNullFlags in interface IChunkNullable<Double>
        Returns:
        the runnable to run to destroy the nullable flags