Examples of LongOpenHashSet


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

Examples of com.carrotsearch.hppc.LongOpenHashSet

            }

            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

Examples of com.carrotsearch.hppc.LongOpenHashSet

        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

Examples of com.carrotsearch.hppc.LongOpenHashSet

        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

Examples of it.unimi.dsi.fastutil.longs.LongOpenHashSet

  }

  @Override
  public RandomAccessFilter buildRandomAccessAndFilter(String[] vals,
      Properties prop) throws IOException {
    LongSet longSet = new LongOpenHashSet();
    for (String val : vals){
      try{
        longSet.add(Long.parseLong(val));
      }
      catch(Exception e){
        throw new IOException(e.getMessage());
      }
    }
    if (longSet.size()!=1){
      return EmptyFilter.getInstance();
    }
    else{
      return buildRandomAccessFilter(longSet.iterator().nextLong());
    }
  }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongOpenHashSet

  }

  @Override
  public RandomAccessFilter buildRandomAccessOrFilter(String[] vals,
      Properties prop, boolean isNot) throws IOException {
    LongSet longSet = new LongOpenHashSet();
    for (String val : vals){
      try{
        longSet.add(Long.parseLong(val));
      }
      catch(Exception e){
        throw new IOException(e.getMessage());
      }
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongOpenHashSet

    // assertion helpers
    /**
     * Asserts that values in both sets are exactly equal.
     */
    private static void assertElementsEqual(final HLL hllA, final HLL hllB) {
        final LongOpenHashSet internalSetA = (LongOpenHashSet)getInternalState(hllA, "explicitStorage");
        final LongOpenHashSet internalSetB = (LongOpenHashSet)getInternalState(hllB, "explicitStorage");

        assertTrue(internalSetA.equals(internalSetB));
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongOpenHashSet

        switch(type) {
            case EMPTY:
                // nothing to be done
                break;
            case EXPLICIT:
                this.explicitStorage = new LongOpenHashSet();
                break;
            case SPARSE:
                this.sparseProbabilisticStorage = new Int2ByteOpenHashMap();
                break;
            case FULL:
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongOpenHashSet

      deleteDirectory(idxDir);
    }
  }

  public void testUIDDocIdSet() throws IOException{
    LongOpenHashSet uidset = new LongOpenHashSet();
    int count = 100;
    Random rand = new Random();
    int id;
    for (int i=0;i<count;++i){
      do { id = rand.nextInt(); } while(id == ZoieIndexReader.DELETED_UID || uidset.contains(id));
      uidset.add(id);
    }

    long[] uidArray = uidset.toLongArray();

    long[] even = new long[uidArray.length/2];
    int[] ans = new int[even.length];
    for (int i=0;i<even.length;++i){
      even[i]=uidArray[i*2];
 
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongOpenHashSet

    BaseSearchIndex<R,V> idx = getSearchIndex();

    Long2ObjectMap<List<IndexingReq>> addList = new Long2ObjectOpenHashMap<List<IndexingReq>>();
    V version = idx.getVersion();    // current version

    LongSet delSet =new LongOpenHashSet();
   
    try {
      for(DataEvent<ZoieIndexable,V> evt : events)
      {
        if (evt == null) continue;
            //version = Math.max(version, evt.getVersion());
            version = version == null ? evt.getVersion() : (version.compareTo(evt.getVersion()) < 0 ? evt.getVersion() : version);
            // interpret and get get the indexable instance
            ZoieIndexable indexable = evt.getData();
            if (indexable == null || indexable.isSkip())
              continue;
   
            long uid = indexable.getUID();
            delSet.add(uid);
            addList.remove(uid);
        if (!indexable.isDeleted()) // update event
        {
          IndexingReq[] reqs = indexable.buildIndexingReqs();
          for (IndexingReq req : reqs) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.