Package it.unimi.dsi.fastutil.longs

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


  }

  @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


  }

  @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

    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

        ZoieIndexReader<R> oldReader = _currentReader;
        _currentReader = reader;
        if (oldReader != null)
          ((ZoieIndexReader) oldReader).decZoieRef();// .decRef();
      }
      LongSet delDocs = _delDocs;
      clearDeletes();
      markDeletes(delDocs); // re-mark deletes
      commitDeletes();
    }
  }
View Full Code Here

  public void refresh()
  {
    synchronized(this)
    {
      try {
        LongSet delDocs = _delDocs;
        clearDeletes();
        _dispenser.getNewReader();
        markDeletes(delDocs); // re-mark deletes
        commitDeletes();
      } catch (IOException e) {
View Full Code Here

      if(reader == null) return;
     
      Directory dir = reader.directory();
     
      // hao: delete docs in disk index
      LongSet delDocs = _delDocs;
      clearDeletes();
      deleteDocs(delDocs);
     
      // hao: merge the readOnly ram index with the disk index
      IndexWriter writer = null;
View Full Code Here

            File file = new File(workingDir, name);
            try {
                Closer closer = Closer.create();
                try {
                    PrintWriter writer = closer.register(new PrintWriter(file));
                    LongSet ids = getIds();
                    LongIterator iter = ids.iterator();
                    while (iter.hasNext()) {
                        writer.println(iter.nextLong());
                    }
                } catch (Throwable th) {
                    throw closer.rethrow(th);
View Full Code Here

    @Override
    public void predict(long uid, @Nonnull MutableSparseVector predictions) {
        logger.debug("predicting {} items for {}", predictions.keyDomain().size(), uid);
        OrdRecModel params = new OrdRecModel(quantizer);
        SparseVector ratings = makeUserVector(uid, userEventDao);
        LongSet keySet = LongUtils.setUnion(ratings.keySet(), predictions.keyDomain());
        MutableSparseVector scores = MutableSparseVector.create(keySet);
        itemScorer.score(uid, scores);
        params.train(ratings, scores);
        logger.debug("trained parameters for {}: {}", uid, params);
View Full Code Here

                (Event) Ratings.make(42, 39, 2.5),
                Ratings.make(42, 62, 3.5),
                Ratings.make(42, 22, 3));
        UserHistory<Event> history = History.forUser(42, events);
        assertThat(history, hasSize(3));
        LongSet ids = history.itemSet();
        assertThat(ids, hasSize(3));
        assertThat(ids, containsInAnyOrder(39L, 62L, 22L));
    }
View Full Code Here

        LongCollection qset = items;
        if (vector.size() < qset.size()) {
            qset = vector.keySet();
        }
        final LongSet candidates = new LongOpenHashSet();
        for (LongIterator iter = qset.iterator(); iter.hasNext();) {
            final long item = iter.nextLong();
            LongSet users = snapshot.getItemUsers(item);
            if (users != null) {
                candidates.addAll(users);
            }
        }
        candidates.remove(uid);
View Full Code Here

TOP

Related Classes of it.unimi.dsi.fastutil.longs.LongSet

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.