test_class.file: ml/streaminer/src/test/java/org/streaminer/stream/membership/CountingBloomFilterTest.java
test_class.identifier: CountingBloomFilterTest
test_case.body: @Test
      public void testAdd() {
          System.out.println("add");
          Random r = new Random();
          CountingBloomFilter instance = new CountingBloomFilter(10000, 32, Hash.MURMUR_HASH);
          Map<Integer, Integer> count = new HashMap<Integer, Integer>(1000);
          
          for (int i=0; i<1000; i++) {
              int num = r.nextInt(10);
              Key k = new Key(String.valueOf(num).getBytes());
              instance.add(k);
              
              int c = 1;
              if (count.containsKey(num))
                  c = c + count.get(num);
              count.put(num, c);
          }
  
          System.out.println("Num\tEst.\tActual");
          for (int i=0; i<10; i++) {
              Key k = new Key(String.valueOf(i).getBytes());
              System.out.println(i + "\t" + instance.estimateCount(k) + "\t" + count.get(i));
          }
      }
test_case.class_method_signature: CountingBloomFilterTest.testAdd()
test_case.full_signature: @Test public void testAdd()
test_case.identifier: testAdd
test_case.invocations: println nextInt getBytes valueOf add containsKey get put println getBytes valueOf println estimateCount get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAdd()
focal_class.declarator: buckets
focal_class.modifier: private
focal_class.original_string: private long[] buckets;
focal_class.type: long[]
focal_class.var_name: buckets
focal_class.declarator: BUCKET_MAX_VALUE = 15
focal_class.modifier: private final static
focal_class.original_string: private final static long BUCKET_MAX_VALUE = 15;
focal_class.type: long
focal_class.var_name: BUCKET_MAX_VALUE
focal_class.file: ml/streaminer/src/main/java/org/streaminer/stream/membership/CountingBloomFilter.java
focal_class.identifier: CountingBloomFilter
focal_class.class_method_signature: CountingBloomFilter.CountingBloomFilter()
focal_class.full_signature: public  CountingBloomFilter()
focal_class.identifier: CountingBloomFilter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  CountingBloomFilter()
focal_class.class_method_signature: CountingBloomFilter.CountingBloomFilter(int vectorSize, int nbHash, int hashType)
focal_class.full_signature: public  CountingBloomFilter(int vectorSize, int nbHash, int hashType)
focal_class.identifier: CountingBloomFilter
focal_class.modifiers: public
focal_class.parameters: (int vectorSize, int nbHash, int hashType)
focal_class.signature:  CountingBloomFilter(int vectorSize, int nbHash, int hashType)
focal_class.class_method_signature: CountingBloomFilter.buckets2words(int vectorSize)
focal_class.full_signature: private static int buckets2words(int vectorSize)
focal_class.identifier: buckets2words
focal_class.modifiers: private static
focal_class.parameters: (int vectorSize)
focal_class.return: int
focal_class.signature: int buckets2words(int vectorSize)
focal_class.class_method_signature: CountingBloomFilter.add(Key key)
focal_class.full_signature: @Override public void add(Key key)
focal_class.identifier: add
focal_class.modifiers: @Override public
focal_class.parameters: (Key key)
focal_class.return: void
focal_class.signature: void add(Key key)
focal_class.class_method_signature: CountingBloomFilter.delete(Key key)
focal_class.full_signature: public void delete(Key key)
focal_class.identifier: delete
focal_class.modifiers: public
focal_class.parameters: (Key key)
focal_class.return: void
focal_class.signature: void delete(Key key)
focal_class.class_method_signature: CountingBloomFilter.and(AbstractFilter filter)
focal_class.full_signature: @Override public void and(AbstractFilter filter)
focal_class.identifier: and
focal_class.modifiers: @Override public
focal_class.parameters: (AbstractFilter filter)
focal_class.return: void
focal_class.signature: void and(AbstractFilter filter)
focal_class.class_method_signature: CountingBloomFilter.membershipTest(Key key)
focal_class.full_signature: @Override public boolean membershipTest(Key key)
focal_class.identifier: membershipTest
focal_class.modifiers: @Override public
focal_class.parameters: (Key key)
focal_class.return: boolean
focal_class.signature: boolean membershipTest(Key key)
focal_class.class_method_signature: CountingBloomFilter.estimateCount(Key key)
focal_class.full_signature: public int estimateCount(Key key)
focal_class.identifier: estimateCount
focal_class.modifiers: public
focal_class.parameters: (Key key)
focal_class.return: int
focal_class.signature: int estimateCount(Key key)
focal_class.class_method_signature: CountingBloomFilter.not()
focal_class.full_signature: @Override public void not()
focal_class.identifier: not
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void not()
focal_class.class_method_signature: CountingBloomFilter.or(AbstractFilter filter)
focal_class.full_signature: @Override public void or(AbstractFilter filter)
focal_class.identifier: or
focal_class.modifiers: @Override public
focal_class.parameters: (AbstractFilter filter)
focal_class.return: void
focal_class.signature: void or(AbstractFilter filter)
focal_class.class_method_signature: CountingBloomFilter.xor(AbstractFilter filter)
focal_class.full_signature: @Override public void xor(AbstractFilter filter)
focal_class.identifier: xor
focal_class.modifiers: @Override public
focal_class.parameters: (AbstractFilter filter)
focal_class.return: void
focal_class.signature: void xor(AbstractFilter filter)
focal_class.class_method_signature: CountingBloomFilter.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: CountingBloomFilter.write(DataOutput out)
focal_class.full_signature: @Override public void write(DataOutput out)
focal_class.identifier: write
focal_class.modifiers: @Override public
focal_class.parameters: (DataOutput out)
focal_class.return: void
focal_class.signature: void write(DataOutput out)
focal_class.class_method_signature: CountingBloomFilter.readFields(DataInput in)
focal_class.full_signature: @Override public void readFields(DataInput in)
focal_class.identifier: readFields
focal_class.modifiers: @Override public
focal_class.parameters: (DataInput in)
focal_class.return: void
focal_class.signature: void readFields(DataInput in)
focal_class.superclass: extends AbstractFilter
focal_method.body: @Override
    public void add(Key key) {
      if(key == null) {
        throw new NullPointerException("key can not be null");
      }
  
      int[] h = hash.hash(key);
      hash.clear();
  
      for(int i = 0; i < nbHash; i++) {
        // find the bucket
        int wordNum = h[i] >> 4;          // div 16
        int bucketShift = (h[i] & 0x0f) << 2;  // (mod 16) * 4
        
        long bucketMask = 15L << bucketShift;
        long bucketValue = (buckets[wordNum] & bucketMask) >>> bucketShift;
        
        // only increment if the count in the bucket is less than BUCKET_MAX_VALUE
        if(bucketValue < BUCKET_MAX_VALUE) {
          // increment by 1
          buckets[wordNum] = (buckets[wordNum] & ~bucketMask) | ((bucketValue + 1) << bucketShift);
        }
      }
    }
focal_method.class_method_signature: CountingBloomFilter.add(Key key)
focal_method.full_signature: @Override public void add(Key key)
focal_method.identifier: add
focal_method.invocations: hash clear
focal_method.modifiers: @Override public
focal_method.parameters: (Key key)
focal_method.return: void
focal_method.signature: void add(Key key)