Package org.elasticsearch.common.util

Examples of org.elasticsearch.common.util.IntArray


    public void merge(long thisBucket, HyperLogLogPlusPlus other, long otherBucket) {
        Preconditions.checkArgument(p == other.p);
        ensureCapacity(thisBucket + 1);
        if (other.algorithm.get(otherBucket) == LINEAR_COUNTING) {
            final IntArray values = other.hashSet.values(otherBucket);
            try {
                for (long i = 0; i < values.size(); ++i) {
                    final int encoded = values.get(i);
                    if (algorithm.get(thisBucket) == LINEAR_COUNTING) {
                        collectLcEncoded(thisBucket, encoded);
                    } else {
                        collectHllEncoded(thisBucket, encoded);
                    }
View Full Code Here


        }
    }

    void upgradeToHll(long bucket) {
        ensureCapacity(bucket + 1);
        final IntArray values = hashSet.values(bucket);
        try {
            runLens.fill(bucket << p, (bucket << p) + m, (byte) 0);
            for (long i = 0; i < values.size(); ++i) {
                final int encoded = values.get(i);
                collectHllEncoded(bucket, encoded);
            }
            algorithm.set(bucket);
        } finally {
            Releasables.close(values);
View Full Code Here

            }
        }

        public IntArray values(final long bucket) {
            final int size = size(bucket);
            final IntArray values = bigArrays.newIntArray(size);
            if (size == 0) {
                return values;
            }
            int i = 0;
            for (int j = 0; j < capacity; ++j) {
                final int k = get(bucket, j);
                if (k != 0) {
                    values.set(i++, k);
                }
            }
            assert i == values.size();
            return values;
        }
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.util.IntArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.