List of usage examples for com.google.common.primitives Floats BYTES
int BYTES
To view the source code for com.google.common.primitives Floats BYTES.
Click Source Link
From source file:io.druid.query.groupby.epinephelinae.column.FloatGroupByColumnSelectorStrategy.java
@Override public int getGroupingKeySize() { return Floats.BYTES; }
From source file:io.druid.query.aggregation.HistogramBufferAggregator.java
public HistogramBufferAggregator(FloatColumnSelector selector, float[] breaks) { this.selector = selector; this.breaks = breaks; this.minOffset = Longs.BYTES * (breaks.length + 1); this.maxOffset = this.minOffset + Floats.BYTES; }
From source file:com.metamx.druid.aggregation.HistogramBufferAggregator.java
public HistogramBufferAggregator(FloatMetricSelector selector, float[] breaks) { this.selector = selector; this.breaks = breaks; this.minOffset = Longs.BYTES * (breaks.length + 1); this.maxOffset = this.minOffset + Floats.BYTES; }
From source file:io.druid.segment.data.BlockLayoutIndexedFloatSupplier.java
public BlockLayoutIndexedFloatSupplier(int totalSize, int sizePer, ByteBuffer fromBuffer, ByteOrder order, CompressedObjectStrategy.CompressionStrategy strategy) { baseFloatBuffers = GenericIndexed.read(fromBuffer, VSizeCompressedObjectStrategy.getBufferForOrder(order, strategy, sizePer * Floats.BYTES)); this.totalSize = totalSize; this.sizePer = sizePer; }
From source file:com.metamx.druid.index.v1.CompressedFloatBufferObjectStrategy.java
private CompressedFloatBufferObjectStrategy(final ByteOrder order) { super(order, new BufferConverter<FloatBuffer>() { @Override// w w w. ja va 2s . c o m public FloatBuffer convert(ByteBuffer buf) { return buf.asFloatBuffer(); } @Override public int compare(FloatBuffer lhs, FloatBuffer rhs) { return Ordering.natural().nullsFirst().compare(lhs, rhs); } @Override public int sizeOf(int count) { return count * Floats.BYTES; } @Override public FloatBuffer combine(ByteBuffer into, FloatBuffer from) { return into.asFloatBuffer().put(from); } }); }
From source file:io.druid.segment.data.CompressedFloatBufferObjectStrategy.java
private CompressedFloatBufferObjectStrategy(final ByteOrder order, final CompressionStrategy compression, final int sizePer) { super(order, new BufferConverter<FloatBuffer>() { @Override/*from w w w. j av a2s.c o m*/ public FloatBuffer convert(ByteBuffer buf) { return buf.asFloatBuffer(); } @Override public int compare(FloatBuffer lhs, FloatBuffer rhs) { return Ordering.natural().nullsFirst().compare(lhs, rhs); } @Override public int sizeOf(int count) { return count * Floats.BYTES; } @Override public FloatBuffer combine(ByteBuffer into, FloatBuffer from) { return into.asFloatBuffer().put(from); } }, compression, sizePer); }
From source file:io.druid.segment.data.EntireLayoutFloatSupplierSerializer.java
public EntireLayoutFloatSupplierSerializer(IOPeon ioPeon, String filenameBase, ByteOrder order) { this.ioPeon = ioPeon; this.valueFile = filenameBase + ".value"; this.metaFile = filenameBase + ".format"; orderBuffer = ByteBuffer.allocate(Floats.BYTES); orderBuffer.order(order);/*from w w w . java2 s . co m*/ }
From source file:io.druid.segment.data.BlockLayoutFloatSupplierSerializer.java
public BlockLayoutFloatSupplierSerializer(IOPeon ioPeon, String filenameBase, ByteOrder order, CompressedObjectStrategy.CompressionStrategy compression) { this.ioPeon = ioPeon; this.sizePer = CompressedPools.BUFFER_SIZE / Floats.BYTES; this.flattener = new GenericIndexedWriter<>(ioPeon, filenameBase, CompressedFloatBufferObjectStrategy.getBufferForOrder(order, compression, sizePer)); this.metaFile = filenameBase + ".format"; this.compression = compression; endBuffer = FloatBuffer.allocate(sizePer); endBuffer.mark();/*from w w w . j a va 2 s .co m*/ }
From source file:io.druid.query.cache.CacheKeyBuilder.java
private static byte[] floatArrayToByteArray(float[] input) { final ByteBuffer buffer = ByteBuffer.allocate(Floats.BYTES * input.length); buffer.asFloatBuffer().put(input);/*from w ww . j av a 2s . c o m*/ return buffer.array(); }
From source file:com.metamx.collections.spatial.ImmutableNode.java
public ImmutableNode(int numDims, int initialOffset, int offsetFromInitial, ByteBuffer data, BitmapFactory bitmapFactory) {// ww w . j a v a 2 s .com this.bitmapFactory = bitmapFactory; this.numDims = numDims; this.initialOffset = initialOffset; this.offsetFromInitial = offsetFromInitial; short header = data.getShort(initialOffset + offsetFromInitial); this.isLeaf = (header & 0x8000) != 0; this.numChildren = (short) (header & 0x7FFF); final int sizePosition = initialOffset + offsetFromInitial + HEADER_NUM_BYTES + 2 * numDims * Floats.BYTES; int bitmapSize = data.getInt(sizePosition); this.childrenOffset = initialOffset + offsetFromInitial + HEADER_NUM_BYTES + 2 * numDims * Floats.BYTES + Ints.BYTES + bitmapSize; this.data = data; }