Examples of LongList


Examples of be.bagofwords.db.data.LongList

    @Override
    protected void writeInt(long key, T value) {
        baseInterface.write(key, value);
        for (long indexKey : indexer.convertToIndexes(value)) {
            indexedDataInterface.write(indexKey, new LongList(key));
        }
    }
View Full Code Here

Examples of com.almworks.integers.LongList

  }

  public long[] toArray(int sourceOffset, long[] dest, int destOffset, int length) {
    int slices = mySlices.size();
    for (int i = 0; i < slices && length > 0; i++) {
      LongList list = mySlices.get(i);
      int size = list.size();
      if (sourceOffset >= size) {
        sourceOffset -= size;
      } else {
        int x = Math.min(size - sourceOffset, length);
        list.toArray(sourceOffset, dest, destOffset, x);
        destOffset += x;
        sourceOffset = 0;
        length -= x;
      }
    }
View Full Code Here

Examples of com.gs.collections.api.list.primitive.LongList

        }
        if (!(otherList instanceof LongList))
        {
            return false;
        }
        LongList list = (LongList) otherList;
        if (this.size != list.size())
        {
            return false;
        }
        for (int i = 0; i < this.size; i++)
        {
            if (this.items[i] != list.get(i))
            {
                return false;
            }
        }
        return true;
View Full Code Here

Examples of com.gs.collections.api.list.primitive.LongList

        }
        if (!(otherList instanceof LongList))
        {
            return false;
        }
        LongList list = (LongList) otherList;
        if (list.size() != 1)
        {
            return false;
        }
        return this.element1 == list.get(0);
    }
View Full Code Here

Examples of com.gs.collections.api.list.primitive.LongList

        }
        if (!(otherList instanceof LongList))
        {
            return false;
        }
        LongList list = (LongList) otherList;
        if (this.items.length != list.size())
        {
            return false;
        }
        for (int i = 0; i < this.items.length; i++)
        {
            if (this.items[i] != list.get(i))
            {
                return false;
            }
        }
        return true;
View Full Code Here

Examples of com.gs.collections.api.list.primitive.LongList

        }
        if (!(otherList instanceof LongList))
        {
            return false;
        }
        LongList list = (LongList) otherList;
        return list.isEmpty();
    }
View Full Code Here

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

      sizes = queryProperties != null && queryProperties.containsKey( UriKeys.SUCCINCTSIZES ) ? readSizesSuccinct( basename + DiskBasedIndex.SIZES_EXTENSION, numberOfDocuments ) : readSizes( basename + DiskBasedIndex.SIZES_EXTENSION, numberOfDocuments );
      if ( sizes.size() != numberOfDocuments ) throw new IllegalStateException( "The length of the size list (" + sizes.size() + ") is not equal to the number of documents (" + numberOfDocuments + ")" );
    }
   
    // Load offsets if forced to do so. Depending on a property, we use the core-memory or the semi-external version.
    final LongList offsets;
    // TODO: quick patch to avoid loading sizes in case of payloads.
    if ( payload == null && randomAccess ) {
      int offsetStep = queryProperties != null && queryProperties.get( UriKeys.OFFSETSTEP ) != null ? Integer.parseInt( queryProperties.get( UriKeys.OFFSETSTEP ) ) : DEFAULT_OFFSET_STEP;
     
      if ( offsetStep < 0 ) { // Memory-mapped
        offsetStep  = -offsetStep;
        offsets = LongLists.synchronize( new SemiExternalOffsetList(
            new InputBitStream( ByteBufferInputStream.map( new FileInputStream( basename + DiskBasedIndex.OFFSETS_EXTENSION ).getChannel(), MapMode.READ_ONLY ) ),
            offsetStep, numberOfTerms + 1 ) );
      }
      else {
        offsets = offsetStep == 0?
            DiskBasedIndex.readOffsets( basename + DiskBasedIndex.OFFSETS_EXTENSION, numberOfTerms ) :
              LongLists.synchronize( new SemiExternalOffsetList( new InputBitStream( basename + DiskBasedIndex.OFFSETS_EXTENSION, 1024 ), offsetStep, numberOfTerms + 1 ) );
      }
      if ( offsets.size() != numberOfTerms + 1 ) throw new IllegalStateException( "The length of the offset list (" + offsets.size() + ") is not equal to the number of terms plus one (" + numberOfTerms + " + 1)" );
    }
    else offsets = null;
   
   
    final int quantum = properties.getInt( BitStreamIndex.PropertyKeys.SKIPQUANTUM, -1 );
View Full Code Here

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

 
    public void testSemiExternalOffsetListGammaCoding() throws IOException {

    long[] offsets = { 10, 300, 450, 650, 1000, 1290, 1699 };
    LongList listOffsets = new LongArrayList( offsets );

    SemiExternalOffsetList list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 1, listOffsets.size() );
    for ( int i = 0; i < offsets.length; ++i ) {
      assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
    }

    list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 2, listOffsets.size() );
    for ( int i = 0; i < offsets.length; ++i ) {
      assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
    }

    list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 4, listOffsets.size() );
    for ( int i = 0; i < offsets.length; ++i ) {
      assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
    }

    list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 7, listOffsets.size() );
    for ( int i = 0; i < offsets.length; ++i ) {
      assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
    }
   
    list = new SemiExternalOffsetList( buildInputStream( listOffsets ), 8, listOffsets.size() );
    for ( int i = 0; i < offsets.length; ++i ) {
      assertEquals( ( "test failed for index: " + i ), offsets[ i ], list.getLong( i ) );
    }
    }
View Full Code Here

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

    }

    public void testEmptySemiExternalOffsetListGammaCoding() throws IOException {

    long[] offsets = {  };
    LongList listOffsets = new LongArrayList( offsets );

    new SemiExternalOffsetList( buildInputStream( listOffsets ), 1, listOffsets.size() );
    assertTrue( true );
    }
View Full Code Here

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

    ZoieSystem<IndexReader,DocumentWithID> zoie = zoieHome.getZoieSystem();
    if (zoie==null){
      throw new IOException("zoie is not setup");
    }

    final LongList delList = new LongArrayList();
   
    List<ZoieIndexReader<IndexReader>> readerList = null;
    IndexSearcher searcher = null;
    try{
      readerList = zoie.getIndexReaders();
      MultiReader reader = new MultiReader(readerList.toArray(new IndexReader[readerList.size()]), false);
      searcher = new IndexSearcher(reader);
      searcher.search(q, new Collector(){
        ZoieIndexReader<IndexReader> zoieReader = null;
        int base = 0;
        @Override
        public boolean acceptsDocsOutOfOrder() {
          return true;
        }

        @Override
        public void collect(int doc) throws IOException {
          long uid = zoieReader.getUID(doc+base);
          if (uid!=DocIDMapper.NOT_FOUND){
            delList.add(uid);
          }
        }

        @Override
        public void setNextReader(IndexReader reader, int base)
            throws IOException {
          zoieReader = (ZoieIndexReader<IndexReader>)reader;
          this.base = base;
        }

        @Override
        public void setScorer(Scorer scorer) throws IOException {
         
        }
       
      });
     
     
     
    }
    finally{
      try{
        if (searcher!=null){
        searcher.close();
        }
      }
      finally{
           if (readerList!=null){
        zoie.returnIndexReaders(readerList);
        }
      }
    }
   
    if (delList.size()>0){
      long version = zoie.getCurrentVersion();
      ArrayList<DataEvent<DocumentWithID>> eventList = new ArrayList<DataEvent<DocumentWithID>>(delList.size());
      for (long val : delList){
        eventList.add(new DataEvent<DocumentWithID>(version,new DocumentWithID(val,true)));
      }
      try {
        zoie.consume(eventList);
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.