test_class.file: ml/streaminer/src/test/java/org/streaminer/stream/cardinality/TestAdaptiveCounting.java
test_class.identifier: TestAdaptiveCounting
test_case.body: @Test
      public void testMerge() throws CardinalityMergeException
      {
          int numToMerge = 10;
          int cardinality = 10000;
  
          AdaptiveCounting[] lcs = new AdaptiveCounting[numToMerge];
          AdaptiveCounting baseline = new AdaptiveCounting(16);
          for (int i = 0; i < numToMerge; i++)
          {
              lcs[i] = new AdaptiveCounting(16);
              for (int j = 0; j < cardinality; j++)
              {
                  double val = Math.random();
                  lcs[i].offer(val);
                  baseline.offer(val);
              }
          }
  
          int expectedCardinality = numToMerge * cardinality;
          long mergedEstimate = AdaptiveCounting.mergeEstimators(lcs).cardinality();
          double error = Math.abs(mergedEstimate - expectedCardinality) / (double) expectedCardinality;
          assertEquals(0.01, error, 0.01);
  
          AdaptiveCounting lc = lcs[0];
          lcs = Arrays.asList(lcs).subList(1, lcs.length).toArray(new AdaptiveCounting[0]);
          mergedEstimate = lc.merge(lcs).cardinality();
          error = Math.abs(mergedEstimate - expectedCardinality) / (double) expectedCardinality;
          assertEquals(0.01, error, 0.01);
  
          assertEquals(baseline.cardinality(), mergedEstimate);
      }
test_case.class_method_signature: TestAdaptiveCounting.testMerge()
test_case.full_signature: @Test public void testMerge()
test_case.identifier: testMerge
test_case.invocations: random offer offer cardinality mergeEstimators abs assertEquals toArray subList asList cardinality merge abs assertEquals assertEquals cardinality
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMerge()
focal_class.declarator: b_e
focal_class.modifier: protected
focal_class.original_string: protected int b_e;
focal_class.type: int
focal_class.var_name: b_e
focal_class.declarator: B_s = 0.051
focal_class.modifier: protected final
focal_class.original_string: protected final double B_s = 0.051;
focal_class.type: double
focal_class.var_name: B_s
focal_class.file: ml/streaminer/src/main/java/org/streaminer/stream/cardinality/AdaptiveCounting.java
focal_class.identifier: AdaptiveCounting
focal_class.class_method_signature: AdaptiveCounting.AdaptiveCounting(int k)
focal_class.full_signature: public  AdaptiveCounting(int k)
focal_class.identifier: AdaptiveCounting
focal_class.modifiers: public
focal_class.parameters: (int k)
focal_class.signature:  AdaptiveCounting(int k)
focal_class.class_method_signature: AdaptiveCounting.AdaptiveCounting(byte[] M)
focal_class.full_signature: public  AdaptiveCounting(byte[] M)
focal_class.identifier: AdaptiveCounting
focal_class.modifiers: public
focal_class.parameters: (byte[] M)
focal_class.signature:  AdaptiveCounting(byte[] M)
focal_class.class_method_signature: AdaptiveCounting.offer(Object o)
focal_class.full_signature: @Override public boolean offer(Object o)
focal_class.identifier: offer
focal_class.modifiers: @Override public
focal_class.parameters: (Object o)
focal_class.return: boolean
focal_class.signature: boolean offer(Object o)
focal_class.class_method_signature: AdaptiveCounting.cardinality()
focal_class.full_signature: @Override public long cardinality()
focal_class.identifier: cardinality
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long cardinality()
focal_class.class_method_signature: AdaptiveCounting.rho(long x, int k)
focal_class.full_signature: protected static byte rho(long x, int k)
focal_class.identifier: rho
focal_class.modifiers: protected static
focal_class.parameters: (long x, int k)
focal_class.return: byte
focal_class.signature: byte rho(long x, int k)
focal_class.class_method_signature: AdaptiveCounting.merge(IRichCardinality... estimators)
focal_class.full_signature: @Override public IRichCardinality merge(IRichCardinality... estimators)
focal_class.identifier: merge
focal_class.modifiers: @Override public
focal_class.parameters: (IRichCardinality... estimators)
focal_class.return: IRichCardinality
focal_class.signature: IRichCardinality merge(IRichCardinality... estimators)
focal_class.class_method_signature: AdaptiveCounting.mergeEstimators(LogLog... estimators)
focal_class.full_signature: public static AdaptiveCounting mergeEstimators(LogLog... estimators)
focal_class.identifier: mergeEstimators
focal_class.modifiers: public static
focal_class.parameters: (LogLog... estimators)
focal_class.return: AdaptiveCounting
focal_class.signature: AdaptiveCounting mergeEstimators(LogLog... estimators)
focal_class.superclass: extends LogLog
focal_method.body: @Override
      public IRichCardinality merge(IRichCardinality... estimators) throws LogLogMergeException {
          LogLog res = (LogLog) super.merge(estimators);
          return new AdaptiveCounting(res.M);
      }
focal_method.class_method_signature: AdaptiveCounting.merge(IRichCardinality... estimators)
focal_method.full_signature: @Override public IRichCardinality merge(IRichCardinality... estimators)
focal_method.identifier: merge
focal_method.invocations: merge
focal_method.modifiers: @Override public
focal_method.parameters: (IRichCardinality... estimators)
focal_method.return: IRichCardinality
focal_method.signature: IRichCardinality merge(IRichCardinality... estimators)