Java Code Examples for it.uniroma3.mat.extendedset.intset.ConciseSet#add()

The following examples show how to use it.uniroma3.mat.extendedset.intset.ConciseSet#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConciseBitmapFactoryTest.java    From bytebuffer-collections with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetOutOfBounds()
{
  final ConciseSet conciseSet = new ConciseSet();
  final Set<Integer> ints = ImmutableSet.of(0, 4, 9);
  for (int i : ints) {
    conciseSet.add(i);
  }
  final ImmutableBitmap immutableBitmap = new WrappedImmutableConciseBitmap(
      ImmutableConciseSet.newImmutableFromMutable(conciseSet));
  final MutableBitmap mutableBitmap = new WrappedConciseBitmap(conciseSet);
  for (int i = 0; i < 10; ++i) {
    Assert.assertEquals(Integer.toString(i), ints.contains(i), mutableBitmap.get(i));
    Assert.assertEquals(Integer.toString(i), ints.contains(i), immutableBitmap.get(i));
  }
}
 
Example 2
Source File: BitMapFilterEvaluator.java    From Kylin with Apache License 2.0 5 votes vote down vote up
private void not(ConciseSet set) {
    if (set == null)
        return;

    set.add(provider.getRecordCount());
    set.complement();
}
 
Example 3
Source File: BitMapFilterEvaluatorTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Override
public ConciseSet getBitMap(TblColRef col, Integer startId, Integer endId) {
    if (!col.equals(colA))
        return null;

    // i-th record has value ID i, and last record has value null
    if (startId == null && endId == null) {
        //entry for getting null value
        ConciseSet s = new ConciseSet();
        s.add(getRecordCount() - 1);
        return s;
    }

    int start = 0;
    int end = MAX_ID;
    if (startId != null) {
        start = startId;
    }
    if (endId != null) {
        end = endId;
    }

    ConciseSet ret = new ConciseSet();
    for (int i = start; i <= end; ++i) {
        ConciseSet temp = getBitMap(col, i);
        ret.addAll(temp);
    }
    return ret;
}
 
Example 4
Source File: BitMapFilterEvaluatorTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
public ConciseSet getBitMap(TblColRef col, int valueId) {
    if (!col.equals(colA))
        return null;

    // i-th record has value ID i, and last record has value null
    ConciseSet bitMap = new ConciseSet();
    if (valueId < 0 || valueId > getMaxValueId(col)) // null
        bitMap.add(getRecordCount() - 1);
    else
        bitMap.add(valueId);

    return bitMap;
}
 
Example 5
Source File: AllRunHorizontalOrBenchmark.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
static ConciseSet toConcise(int[] dat) {
  ConciseSet ans = new ConciseSet();
  for (int i : dat) {
    ans.add(i);
  }
  return ans;
}
 
Example 6
Source File: AllRunHorizontalOrBenchmark.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
static ConciseSet toWAH(int[] dat) {
  ConciseSet ans = new ConciseSet(true);
  for (int i : dat) {
    ans.add(i);
  }
  return ans;
}
 
Example 7
Source File: RunArrayXorBenchmark.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
static ConciseSet toConcise(int[] dat) {
  ConciseSet ans = new ConciseSet();
  for (int i : dat) {
    ans.add(i);
  }
  return ans;
}
 
Example 8
Source File: RunArrayOrBenchmark.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
static ConciseSet toConcise(int[] dat) {
  ConciseSet ans = new ConciseSet();
  for (int i : dat) {
    ans.add(i);
  }
  return ans;
}
 
Example 9
Source File: RunArrayAndNotBenchmark.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
static ConciseSet toConcise(int[] dat) {
  ConciseSet ans = new ConciseSet();
  for (int i : dat) {
    ans.add(i);
  }
  return ans;
}
 
Example 10
Source File: RunArrayAndBenchmark.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
static ConciseSet toConcise(int[] dat) {
  ConciseSet ans = new ConciseSet();
  for (int i : dat) {
    ans.add(i);
  }
  return ans;
}
 
Example 11
Source File: BitmapFactory.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
private static ConciseSet newConciseSet(int[] data, boolean simulateWAH) {
  ConciseSet concise = new ConciseSet(simulateWAH);
  for (int i : data) {
    concise.add(i);
  }
  return concise;
}
 
Example 12
Source File: BitMapFilterEvaluator.java    From Kylin with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
    ConciseSet s = new ConciseSet();
    s.add(5);
    s.complement();
    System.out.println(s);
}
 
Example 13
Source File: RangeBitmapBenchmarkTest.java    From bytebuffer-collections with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void prepareRandomRanges() throws Exception
{
  System.setProperty("jub.customkey", String.format("%06.5f", DENSITY));
  reset();

  final BitSet expectedUnion = new BitSet();
  for (int i = 0; i < SIZE; ++i) {
    ConciseSet c = new ConciseSet();
    MutableRoaringBitmap r = new MutableRoaringBitmap();
    {
      int k = 0;
      boolean fill = true;
      while (k < LENGTH) {
        int runLength = (int) (LENGTH * DENSITY) + rand.nextInt((int) (LENGTH * DENSITY));
        for (int j = k; fill && j < LENGTH && j < k + runLength; ++j) {
          c.add(j);
          r.add(j);
          expectedUnion.set(j);
        }
        k += runLength;
        fill = !fill;
      }
    }
    minIntersection = MIN_INTERSECT;
    for (int k = LENGTH / 2; k < LENGTH / 2 + minIntersection; ++k) {
      c.add(k);
      r.add(k);
      expectedUnion.set(k);
    }
    concise[i] = ImmutableConciseSet.newImmutableFromMutable(c);
    offheapConcise[i] = makeOffheapConcise(concise[i]);
    roaring[i] = r;
    immutableRoaring[i] = makeImmutableRoaring(r);
    offheapRoaring[i] = makeOffheapRoaring(r);
    genericConcise[i] = new WrappedImmutableConciseBitmap(offheapConcise[i]);
    genericRoaring[i] = new WrappedImmutableRoaringBitmap(offheapRoaring[i]);
  }
  unionCount = expectedUnion.cardinality();
  printSizeStats(DENSITY, "Random Alternating Bitmap");
}