Package it.unimi.dsi.fastutil.longs

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


    if ( indexIterator != null && index.length == 1 && ( documentIterator instanceof AbstractIntersectionDocumentIterator || indexIterator.length < MAX_FLAT_DISJUNCTS ) ) {
      /* This code is a flat, simplified duplication of what a CounterSetupVisitor would do. It is here just for efficiency. */
      numberOfPairs = 0;
      /* Find duplicate terms. We score unique pairs term/index with nonzero frequency, as the standard method would do. */
      final LongOpenHashSet alreadySeen = new LongOpenHashSet();

      for( int i = indexIterator.length; i-- != 0; )
        if ( indexIterator[ i ].frequency() != 0 && alreadySeen.add( indexIterator[ i ].termNumber() ) ) numberOfPairs++;

      if ( numberOfPairs == indexIterator.length ) flatIndexIterator = indexIterator;
      else {
        /* We must compact the array, eliminating zero-frequency iterators. */
        flatIndexIterator = new IndexIterator[ numberOfPairs ];
        alreadySeen.clear();
        for( int i = 0, p = 0; i != indexIterator.length; i++ )
          if ( indexIterator[ i ].frequency() != 0 &&  alreadySeen.add( indexIterator[ i ].termNumber() ) ) flatIndexIterator[ p++ ] = indexIterator[ i ];
      }

      if ( flatIndexIterator.length != 0 ) {
        // Some caching of frequently-used values
        k1TimesBDividedByAverageDocumentSize = k1 * b * flatIndexIterator[ 0 ].index().numberOfDocuments / flatIndexIterator[ 0 ].index().numberOfOccurrences;
View Full Code Here


    /**
     * Constructor
     * @param capacity Capacity
     */
    public BasicLongOpenHashSet(int capacity) {
      set = new LongOpenHashSet(capacity);
    }
View Full Code Here

    EdgeIterables.initialize(this, edges);
  }

  @Override
  public void initialize(int capacity) {
    neighbors = new LongOpenHashSet(capacity);
  }
View Full Code Here

    neighbors = new LongOpenHashSet(capacity);
  }

  @Override
  public void initialize() {
    neighbors = new LongOpenHashSet();
  }
View Full Code Here

  }
 
  @Override
  public boolean containsAny(Object set)
  {
    LongOpenHashSet setLong = (LongOpenHashSet)set;
    for(int i=0; i< this._length; i++)
      if( setLong.contains(((TermLongList) _mTermList).getPrimitiveValue(_buf[i])) )
        return true;
             
    return false;
  }
View Full Code Here

   
  }

  @Override
  public LongOpenHashSet map(int[] docId, int docIdCount, long[] uids, FieldAccessor accessor, FacetCountAccessor facetCountAccessor) {
    LongOpenHashSet hashSet = new LongOpenHashSet(docIdCount);
    for (int i =0; i < docIdCount; i++) {
      hashSet.add(accessor.getLong(column, docId[i]));
    }
   
    return hashSet;
  }
View Full Code Here

  @Override
  public List<LongOpenHashSet> combine(List<LongOpenHashSet> mapResults, CombinerStage combinerStage) {
    if (mapResults.isEmpty()) {
      return mapResults;
    }
    LongOpenHashSet ret = mapResults.get(0);
    for (int i = 1; i < mapResults.size(); i++) {
     ret.addAll(mapResults.get(i));
    }
    mapResults.clear();
    mapResults.add(ret);
    return mapResults;
  }
View Full Code Here

  @Override
  public Integer reduce(List<LongOpenHashSet> combineResults) {
    if (combineResults.isEmpty()) {
      return 0;
    }
    LongOpenHashSet ret = combineResults.get(0);
    for (int i = 1; i < combineResults.size(); i++) {
     ret.addAll(combineResults.get(i));
    }
   
    return ret.size();
  }
View Full Code Here

  }

  @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());
      }
    }
    RandomAccessFilter filter;
    if (longSet.size()==1){
      filter = buildRandomAccessFilter(longSet.iterator().nextLong());
    }
    else{
      filter =  buildRandomAccessFilter(longSet);
    }
    if (filter == null) return filter;
View Full Code Here

TOP

Related Classes of it.unimi.dsi.fastutil.longs.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.