Package com.carrotsearch.hppc

Examples of com.carrotsearch.hppc.LongOpenHashSet


        long[] signature = definition.getSignature();
        writeInlineTypes(signature, relation, writer, tx);


        //Write remaining properties
        LongSet writtenTypes = new LongOpenHashSet(sortKey.length + signature.length);
        if (sortKey.length > 0 || signature.length > 0) {
            for (long id : sortKey) writtenTypes.add(id);
            for (long id : signature) writtenTypes.add(id);
        }
        LongArrayList remainingTypes = new LongArrayList(8);
        for (TitanType t : relation.getPropertyKeysDirect()) {
            if (!writtenTypes.contains(t.getID())) {
                remainingTypes.add(t.getID());

            }
        }
        //Sort types before writing to ensure that value is always written the same way
View Full Code Here


            }

            return FieldDataTermsFilter.newDoubles(fieldData, terms);
        } else {
            // create with initial size large enough to avoid rehashing
            LongOpenHashSet terms =
                    new LongOpenHashSet((int) (values.size() * (1 + LongOpenHashSet.DEFAULT_LOAD_FACTOR)));
            for (int i = 0, len = values.size(); i < len; i++) {
                terms.add(parseLongValue(values.get(i)));
            }

            return FieldDataTermsFilter.newLongs(fieldData, terms);
        }
    }
View Full Code Here

        private LongSet valids;
        private LongSet invalids;

        private LongFilter(int numValids, int numInvalids) {
            if (numValids > 0) {
                valids = new LongOpenHashSet(numValids);
            }
            if (numInvalids > 0) {
                invalids = new LongOpenHashSet(numInvalids);
            }
        }
View Full Code Here

        for (int i = 0; i < values.size(); ++i) {
            Document doc = new Document();
            id.setStringValue("" + i);
            doc.add(id);
            final LongOpenHashSet v = values.get(i);
            final boolean[] states = v.allocated;
            final long[] keys = v.keys;

            for (int j = 0; j < states.length; j++) {
                if (states[j]) {
                    LongField value = new LongField("value", keys[j], Field.Store.NO);
                    doc.add(value);
                }
            }
            writer.addDocument(doc);
        }
        writer.forceMerge(1, true);

        final IndexNumericFieldData indexFieldData = getForField("value");
        final AtomicNumericFieldData atomicFieldData = indexFieldData.load(refreshReader());
        final SortedNumericDocValues data = atomicFieldData.getLongValues();
        final SortedNumericDoubleValues doubleData = atomicFieldData.getDoubleValues();
        final LongOpenHashSet set = new LongOpenHashSet();
        final DoubleOpenHashSet doubleSet = new DoubleOpenHashSet();
        for (int i = 0; i < values.size(); ++i) {
            final LongOpenHashSet v = values.get(i);

            data.setDocument(i);
            assertThat(data.count() > 0, equalTo(!v.isEmpty()));
            doubleData.setDocument(i);
            assertThat(doubleData.count() > 0, equalTo(!v.isEmpty()));

            set.clear();
            data.setDocument(i);
            int numValues = data.count();
            for (int j = 0; j < numValues; j++) {
View Full Code Here

        Random r = getRandom();
        final int numDocs = 1000 + r.nextInt(19000);
        final List<LongOpenHashSet> values = new ArrayList<>(numDocs);
        for (int i = 0; i < numDocs; ++i) {
            final int numValues = data.numValues(r);
            final LongOpenHashSet vals = new LongOpenHashSet(numValues);
            for (int j = 0; j < numValues; ++j) {
                vals.add(data.nextValue(r));
            }
            values.add(vals);
        }
        test(values);
    }
View Full Code Here

TOP

Related Classes of com.carrotsearch.hppc.LongOpenHashSet

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.