test_class.file: ml/streaminer/src/test/java/org/streaminer/stream/cardinality/BJKSTTest.java
test_class.identifier: BJKSTTest
test_case.body: @Test
      public void testOffer() {
          System.out.println("offer");
          BJKST instance = new BJKST(1024, 64, 0.3);
          
          long cardinality = 500L;
          
          System.out.println("First batch:");
          for (long i = 0; i < cardinality; i++) {
              instance.offer(Long.valueOf(i));
              if (i % 50 == 0) {
                  System.out.println("actual: " + i + ", estimated: " + instance.cardinality());
              }
          }
          
          System.out.println("Second batch:");
          for (long i = 0; i < cardinality; i++) {
              instance.offer(Long.valueOf(i));
              if (i % 50 == 0) {
                  System.out.println("actual: " + i + ", estimated: " + instance.cardinality());
              }
          }
  
          System.out.println("actual: " + cardinality + ", estimated: " + instance.cardinality());
          
          assertEquals(cardinality, instance.cardinality(), 100);
      }
test_case.class_method_signature: BJKSTTest.testOffer()
test_case.full_signature: @Test public void testOffer()
test_case.identifier: testOffer
test_case.invocations: println println offer valueOf println cardinality println offer valueOf println cardinality println cardinality assertEquals cardinality
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testOffer()
focal_class.declarator: serialVersionUID = -2032575802259420762L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = -2032575802259420762L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: numMedians=25
focal_class.modifier: private
focal_class.original_string: private int numMedians=25;
focal_class.type: int
focal_class.var_name: numMedians
focal_class.declarator: sizeOfMedianSet
focal_class.modifier: private
focal_class.original_string: private int sizeOfMedianSet;
focal_class.type: int
focal_class.var_name: sizeOfMedianSet
focal_class.declarator: error = 0.02f
focal_class.modifier: private
focal_class.original_string: private double error = 0.02f;
focal_class.type: double
focal_class.var_name: error
focal_class.declarator: limits
focal_class.modifier: private
focal_class.original_string: private List<Integer> limits;
focal_class.type: List<Integer>
focal_class.var_name: limits
focal_class.declarator: bufferSize = 100
focal_class.modifier: private
focal_class.original_string: private int bufferSize = 100;
focal_class.type: int
focal_class.var_name: bufferSize
focal_class.declarator: buffers
focal_class.modifier: private
focal_class.original_string: private List<HashSet<String>> buffers;
focal_class.type: List<HashSet<String>>
focal_class.var_name: buffers
focal_class.declarator: hHashers
focal_class.modifier: private
focal_class.original_string: private List<HashFunction<Object>> hHashers;
focal_class.type: List<HashFunction<Object>>
focal_class.var_name: hHashers
focal_class.declarator: gHashers
focal_class.modifier: private
focal_class.original_string: private List<HashFunction<Object>> gHashers;
focal_class.type: List<HashFunction<Object>>
focal_class.var_name: gHashers
focal_class.declarator: intLength = Integer.toString(Integer.MAX_VALUE).length()
focal_class.modifier: private
focal_class.original_string: private int intLength = Integer.toString(Integer.MAX_VALUE).length();
focal_class.type: int
focal_class.var_name: intLength
focal_class.declarator: lengthOfIntegerRepresentation = null
focal_class.modifier: private
focal_class.original_string: private String lengthOfIntegerRepresentation = null;
focal_class.type: String
focal_class.var_name: lengthOfIntegerRepresentation
focal_class.file: ml/streaminer/src/main/java/org/streaminer/stream/cardinality/BJKST.java
focal_class.identifier: BJKST
focal_class.interfaces: implements Serializable
focal_class.class_method_signature: BJKST.BJKST(int numberOfMedianAttempts, int sizeOfEachMedianSet)
focal_class.full_signature: public  BJKST(int numberOfMedianAttempts, int sizeOfEachMedianSet)
focal_class.identifier: BJKST
focal_class.modifiers: public
focal_class.parameters: (int numberOfMedianAttempts, int sizeOfEachMedianSet)
focal_class.signature:  BJKST(int numberOfMedianAttempts, int sizeOfEachMedianSet)
focal_class.class_method_signature: BJKST.BJKST(int numberOfMedianAttempts, int sizeOfEachMedianSet, double allowedError)
focal_class.full_signature: public  BJKST(int numberOfMedianAttempts, int sizeOfEachMedianSet, double allowedError)
focal_class.identifier: BJKST
focal_class.modifiers: public
focal_class.parameters: (int numberOfMedianAttempts, int sizeOfEachMedianSet, double allowedError)
focal_class.signature:  BJKST(int numberOfMedianAttempts, int sizeOfEachMedianSet, double allowedError)
focal_class.class_method_signature: BJKST.init()
focal_class.full_signature: private void init()
focal_class.identifier: init
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void init()
focal_class.class_method_signature: BJKST.offer(Object o)
focal_class.full_signature: public void offer(Object o)
focal_class.identifier: offer
focal_class.modifiers: public
focal_class.parameters: (Object o)
focal_class.return: void
focal_class.signature: void offer(Object o)
focal_class.class_method_signature: BJKST.cardinality()
focal_class.full_signature: public long cardinality()
focal_class.identifier: cardinality
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long cardinality()
focal_method.body: public void offer(Object o) {
          for ( int i =0 ; i < numMedians; i++) {
              String binaryRepr = Long.toBinaryString(hHashers.get(i).hash(o));
              
              int zereosP = binaryRepr.length() - binaryRepr.lastIndexOf('1');
              int currentZ = limits.get(i);
              
              if (zereosP >= currentZ) {
                  HashSet<String> currentBuffer = buffers.get(i);
                  
                  currentBuffer.add(String.format(lengthOfIntegerRepresentation, gHashers.get(i).hash(o)) +
                              String.format(lengthOfIntegerRepresentation, zereosP));
  
                  while (currentBuffer.size() > bufferSize) {
                      currentZ = currentZ + 1;
                      for (Iterator<String> itr = currentBuffer.iterator(); itr.hasNext();) {
                          String element = itr.next();
                          long zeroesOld = Long.parseLong(element.substring(intLength));
                          if (zeroesOld < currentZ) {
                              itr.remove();
                          }
                      }
                  }
              }
          }
      }
focal_method.class_method_signature: BJKST.offer(Object o)
focal_method.full_signature: public void offer(Object o)
focal_method.identifier: offer
focal_method.invocations: toBinaryString hash get length lastIndexOf get get add format hash get format size iterator hasNext next parseLong substring remove
focal_method.modifiers: public
focal_method.parameters: (Object o)
focal_method.return: void
focal_method.signature: void offer(Object o)