Examples of BigNestedIntArray


Examples of com.browseengine.bobo.util.BigNestedIntArray

  @Override
  public RandomAccessDocIdSet getRandomAccessDocIdSet(BoboIndexReader reader) throws IOException
  {
  final MultiValueFacetDataCache dataCache = (MultiValueFacetDataCache)_facetHandler.getFacetData(reader);
  final int[] index = _valueConverter.convert(dataCache, _vals);
  final BigNestedIntArray nestedArray = dataCache._nestedArray;
  final BitVector bitset = new BitVector(dataCache.valArray.size());
 
  for (int i : index){
    bitset.set(i);
    }
 
  if (_takeCompliment)
    {
      // flip the bits
    int size = bitset.size();
      for (int i=0;i<size;++i){
        if (bitset.get(i)){
          bitset.clear(i);
        }
        else{
          bitset.set(i);
        }
      }
    }
 
  int count = bitset.count();
 
    if (count == 0)
    {
      final DocIdSet empty = EmptyDocIdSet.getInstance();
        return new RandomAccessDocIdSet()
        {
        @Override
        public boolean get(int docId)
        {
          return false;
        }
   
        @Override
        public DocIdSetIterator iterator() throws IOException
        {
          return empty.iterator();
        }        
        };
    }
    else
    {
        return new RandomAccessDocIdSet()
        {
            @Override
            public DocIdSetIterator iterator()
            {
                return new MultiValueOrFacetDocIdSetIterator(dataCache,bitset);
            }

            @Override
            final public boolean get(int docId)
            {
              return nestedArray.contains(docId,bitset);
            }
        };
    }
  }
View Full Code Here

Examples of com.browseengine.bobo.util.BigNestedIntArray

      for(int val = 0; val < 2000; val += (id + 1))
      {
        if(loader.add(id, val)) count[id]++;
      }
    }
    BigNestedIntArray nestedArray = new BigNestedIntArray();
    nestedArray.load(maxId, loader);
   
    int[] buf = new int[1024];
    for(int id = 0; id < maxId; id++)
    {
      int cnt = nestedArray.getData(id, buf);
      assertEquals("item count", count[id], cnt);
     
      if(cnt > 0)
      {
        int val = 0;
View Full Code Here

Examples of com.browseengine.bobo.util.BigNestedIntArray

      for(int val = 0; val < 3000; val += (id + 1))
      {
        if(loader.add(id, val)) count[id]++;
      }
    }
    BigNestedIntArray nestedArray = new BigNestedIntArray();
    nestedArray.load(maxId, loader);
   
    int[] buf = new int[1024];
    for(int id = 0; id < maxId; id++)
    {
      int cnt = nestedArray.getData(id, buf);
      assertEquals("item count", count[id], cnt);
     
      if(cnt > 0)
      {
        int val = 0;
View Full Code Here

Examples of com.browseengine.bobo.util.BigNestedIntArray

        for(int val = 0; val < cnt; val++)
        {
          if(loader.add(id, val)) count[i][id]++;
        }
      }
      nestedArray[i] = new BigNestedIntArray();
      nestedArray[i].load(maxId, loader);
     
      loader.reset(maxId, BigNestedIntArray.MAX_ITEMS, buffer);
    }
   
View Full Code Here

Examples of com.browseengine.bobo.util.BigNestedIntArray

    int[] maxNumItems = {1, 1, 2, 2, 3, 3, 3, 3, 1, 1 };
    int[] minNumItems = {1, 1, 0, 1, 0, 0, 2, 3, 1, 0 };
    int[] count = new int[maxId];
    BigIntBuffer buffer = new BigIntBuffer();
    BufferedLoader loader = null;
    BigNestedIntArray nestedArray = new BigNestedIntArray();
    Random rand = new Random();
   
    for(int i = 0; i < maxNumItems.length; i++)
    {
      loader = new BufferedLoader(maxId, BigNestedIntArray.MAX_ITEMS, buffer);
      for(int id = 0; id < maxId; id++)
      {
        count[id] = 0;
        int cnt = Math.max(rand.nextInt(maxNumItems[i] + 1), minNumItems[i]);
        for(int val = 0; val < cnt; val++)
        {
          if(loader.add(id, val)) count[id]++;
        }
      }
     
      nestedArray.load(maxId, loader);
     
      int[] buf = new int[1024];
      for(int id = 0; id < maxId; id++)
      {
        int cnt = nestedArray.getData(id, buf);
        assertEquals("count["+i+","+id+"]", count[id], cnt);
       
        if(cnt > 0)
        {
          for(int val = 0; val < cnt; val++)
View Full Code Here

Examples of com.browseengine.bobo.util.BigNestedIntArray

      {
        int cnt = id % (maxNumItems[i] + 1);
        loader.addSize(id, cnt);
        count[i][id] = cnt;
      }
      nestedArray[i] = new BigNestedIntArray();
      nestedArray[i].load(maxId, loader);
      loader.reset();

      for(int id = 0; id < maxId; id++)
      {
View Full Code Here

Examples of com.browseengine.bobo.util.BigNestedIntArray

      {
        int cnt = id % 2000;
        loader.addSize(id, cnt);
        count[i][id] = cnt;
      }
      nestedArray[i] = new BigNestedIntArray();
      nestedArray[i].setMaxItems(maxNumItems[i]);
      nestedArray[i].load(maxId, loader);
      loader.reset();

      for(int id = 0; id < maxId; id++)
View Full Code Here

Examples of com.browseengine.bobo.util.BigNestedIntArray

      {
        loader.add(i, val);
      }
    }

    BigNestedIntArray nestedArray = new BigNestedIntArray();
    nestedArray.load(maxId, loader);

    BitVector filter = new BitVector(numVals);
    for (int i = 0; i < numVals; i++)
    {
      if (i % 2 == 0)
      {
        filter.set(i);
      }
    }

    for (int i = 0; i < maxId; i++)
    {
      nestedArray.countNoReturnWithFilter(i, count, filter);
    }

    for (int i = 0; i < numVals; i++)
    {
      if (i % 2 == 0)
View Full Code Here

Examples of com.browseengine.bobo.util.BigNestedIntArray

  private boolean _overflow = false;
 
  public MultiValueFacetDataCache()
  {
    super();
    _nestedArray = new BigNestedIntArray();
  }
View Full Code Here

Examples of com.browseengine.bobo.util.BigNestedIntArray

    for (int id = 0; id < maxId; id++) {
      for (int val = 0; val < 2000; val += (id + 1)) {
        if (loader.add(id, val)) count[id]++;
      }
    }
    BigNestedIntArray nestedArray = new BigNestedIntArray();
    nestedArray.load(maxId, loader);

    int[] buf = new int[1024];
    for (int id = 0; id < maxId; id++) {
      int cnt = nestedArray.getData(id, buf);
      assertEquals("item count", count[id], cnt);

      if (cnt > 0) {
        int val = 0;
        for (int i = 0; i < cnt; i++) {
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.