water.fvec
Class CBSChunk

java.lang.Object
  extended by water.Iced
      extended by water.fvec.Chunk
          extended by water.fvec.CBSChunk
All Implemented Interfaces:
java.lang.Cloneable, Freezable

public class CBSChunk
extends Chunk

A simple chunk for boolean values. In fact simple bit vector. Each boolean is represented by 2bits since we need to represent NA.


Field Summary
protected  byte _bpv
           
protected  byte _gap
           
protected static byte _NA
           
 
Fields inherited from class water.fvec.Chunk
_chk, _len, _start, _vec
 
Constructor Summary
CBSChunk(byte[] bs, byte gap, byte bpv)
           
 
Method Summary
protected  long at8_impl(int idx)
           
protected  byte atb(int idx)
           
protected  double atd_impl(int idx)
          Chunk-specific readers.
static int clen(int values, int bpv)
          Returns compressed len of the given array length if the value if represented by bpv-bits.
protected  boolean isNA_impl(int i)
           
 Chunk read(AutoBuffer bb)
          Deserialize from the AutoBuffer into a pre-existing 'this' object.
static byte read1b(byte b, int off)
          Reads 1bit from given b in given offset.
static byte read2b(byte b, int off)
          Reads 1bit from given b in given offset.
 AutoBuffer write(AutoBuffer bb)
          Chunk-specific implementations of read & write
static byte write1b(byte b, byte val, int off)
          Writes 1bit from value into b at given offset and return b
static byte write2b(byte b, byte val, int off)
          Writes 2bits from value into b at given offset and return b
 
Methods inherited from class water.fvec.Chunk
at_slow, at, at0, at8_slow, at8, at80, byteSize, cidx, clone, close, getBytes, isNA_slow, isNA, isNA0, pformat_len, pformat_len0, pformat_len0, pformat, pformat0, readable, set, set, set, set0, set0, set0, setNA, setNA0, toString, writable
 
Methods inherited from class water.Iced
frozenType, init, newInstance, toDocField, writeJSON, writeJSONFields
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_NA

protected static final byte _NA
See Also:
Constant Field Values

_bpv

protected byte _bpv

_gap

protected byte _gap
Constructor Detail

CBSChunk

public CBSChunk(byte[] bs,
                byte gap,
                byte bpv)
Method Detail

at8_impl

protected long at8_impl(int idx)
Specified by:
at8_impl in class Chunk

atd_impl

protected double atd_impl(int idx)
Description copied from class: Chunk
Chunk-specific readers.

Specified by:
atd_impl in class Chunk

isNA_impl

protected final boolean isNA_impl(int i)
Specified by:
isNA_impl in class Chunk

atb

protected byte atb(int idx)

write

public AutoBuffer write(AutoBuffer bb)
Description copied from class: Chunk
Chunk-specific implementations of read & write

Specified by:
write in interface Freezable
Specified by:
write in class Chunk

read

public Chunk read(AutoBuffer bb)
Description copied from interface: Freezable
Deserialize from the AutoBuffer into a pre-existing 'this' object.

Specified by:
read in interface Freezable
Specified by:
read in class Chunk

write1b

public static byte write1b(byte b,
                           byte val,
                           int off)
Writes 1bit from value into b at given offset and return b


write2b

public static byte write2b(byte b,
                           byte val,
                           int off)
Writes 2bits from value into b at given offset and return b


read1b

public static byte read1b(byte b,
                          int off)
Reads 1bit from given b in given offset.


read2b

public static byte read2b(byte b,
                          int off)
Reads 1bit from given b in given offset.


clen

public static int clen(int values,
                       int bpv)
Returns compressed len of the given array length if the value if represented by bpv-bits.