Java Code Examples for org.elasticsearch.common.util.BigArrays#newByteArray()

The following examples show how to use org.elasticsearch.common.util.BigArrays#newByteArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HyperLogLogPlusPlus.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public HyperLogLogPlusPlus(int precision, BigArrays bigArrays, long initialBucketCount) {
    Preconditions.checkArgument(precision >= 4, "precision must be >= 4");
    Preconditions.checkArgument(precision <= 18, "precision must be <= 18");
    p = precision;
    m = 1 << p;
    this.bigArrays = bigArrays;
    algorithm = new OpenBitSet();
    runLens = bigArrays.newByteArray(initialBucketCount << p);
    hashSet = new Hashset(initialBucketCount);
    final double alpha;
    switch (p) {
    case 4:
        alpha = 0.673;
        break;
    case 5:
        alpha = 0.697;
        break;
    default:
        alpha = 0.7213 / (1 + 1.079 / m);
        break;
    }
    alphaMM = alpha * m * m;
}
 
Example 2
Source File: BytesStreamOutput.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
protected BytesStreamOutput(int expectedSize, BigArrays bigarrays) {
    this.bigarrays = bigarrays;
    this.bytes = bigarrays.newByteArray(expectedSize);
}
 
Example 3
Source File: BytesStreamOutput.java    From crate with Apache License 2.0 4 votes vote down vote up
protected BytesStreamOutput(int expectedSize, BigArrays bigArrays) {
    this.bigArrays = bigArrays;
    this.bytes = bigArrays.newByteArray(expectedSize, false);
}