test_class.file: ml/streaminer/src/test/java/org/streaminer/stream/cardinality/TestLinearCounting.java
test_class.identifier: TestLinearCounting
test_case.body: @Test
      public void testMerge() throws LinearCounting.LinearCountingMergeException
      {
          int numToMerge = 5;
          int size = 65536;
          int cardinality = 1000;
  
          LinearCounting[] lcs = new LinearCounting[numToMerge];
          LinearCounting baseline = new LinearCounting(size);
          for (int i = 0; i < numToMerge; i++)
          {
              lcs[i] = new LinearCounting(size);
              for (int j = 0; j < cardinality; j++)
              {
                  double val = Math.random();
                  lcs[i].offer(val);
                  baseline.offer(val);
              }
          }
  
          int expectedCardinality = numToMerge * cardinality;
          long mergedEstimate = LinearCounting.mergeEstimators(lcs).cardinality();
          double error = Math.abs(mergedEstimate - expectedCardinality) / (double) expectedCardinality;
          assertEquals(0.01, error, 0.01);
  
          LinearCounting lc = lcs[0];
          lcs = Arrays.asList(lcs).subList(1, lcs.length).toArray(new LinearCounting[0]);
          mergedEstimate = lc.merge(lcs).cardinality();
          error = Math.abs(mergedEstimate - expectedCardinality) / (double) expectedCardinality;
          assertEquals(0.01, error, 0.01);
  
          long baselineEstimate = baseline.cardinality();
          assertEquals(baselineEstimate, mergedEstimate);
      }
test_case.class_method_signature: TestLinearCounting.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 cardinality assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMerge()
focal_class.declarator: map
focal_class.modifier: protected
focal_class.original_string: protected byte[] map;
focal_class.type: byte[]
focal_class.var_name: map
focal_class.declarator: length
focal_class.modifier: protected final
focal_class.original_string: protected final int length;
focal_class.type: int
focal_class.var_name: length
focal_class.declarator: count
focal_class.modifier: protected
focal_class.original_string: protected int count;
focal_class.type: int
focal_class.var_name: count
focal_class.file: ml/streaminer/src/main/java/org/streaminer/stream/cardinality/LinearCounting.java
focal_class.identifier: LinearCounting
focal_class.interfaces: implements IRichCardinality
focal_class.class_method_signature: LinearCounting.LinearCounting(int size)
focal_class.full_signature: public  LinearCounting(int size)
focal_class.identifier: LinearCounting
focal_class.modifiers: public
focal_class.parameters: (int size)
focal_class.signature:  LinearCounting(int size)
focal_class.class_method_signature: LinearCounting.LinearCounting(byte[] map)
focal_class.full_signature: public  LinearCounting(byte[] map)
focal_class.identifier: LinearCounting
focal_class.modifiers: public
focal_class.parameters: (byte[] map)
focal_class.signature:  LinearCounting(byte[] map)
focal_class.class_method_signature: LinearCounting.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: LinearCounting.getBytes()
focal_class.full_signature: @Override public byte[] getBytes()
focal_class.identifier: getBytes
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: byte[]
focal_class.signature: byte[] getBytes()
focal_class.class_method_signature: LinearCounting.offerHashed(long hashedLong)
focal_class.full_signature: @Override public boolean offerHashed(long hashedLong)
focal_class.identifier: offerHashed
focal_class.modifiers: @Override public
focal_class.parameters: (long hashedLong)
focal_class.return: boolean
focal_class.signature: boolean offerHashed(long hashedLong)
focal_class.class_method_signature: LinearCounting.offerHashed(int hashedInt)
focal_class.full_signature: @Override public boolean offerHashed(int hashedInt)
focal_class.identifier: offerHashed
focal_class.modifiers: @Override public
focal_class.parameters: (int hashedInt)
focal_class.return: boolean
focal_class.signature: boolean offerHashed(int hashedInt)
focal_class.class_method_signature: LinearCounting.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: LinearCounting.sizeof()
focal_class.full_signature: @Override public int sizeof()
focal_class.identifier: sizeof
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int sizeof()
focal_class.class_method_signature: LinearCounting.computeCount()
focal_class.full_signature: public int computeCount()
focal_class.identifier: computeCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int computeCount()
focal_class.class_method_signature: LinearCounting.getUtilization()
focal_class.full_signature: public double getUtilization()
focal_class.identifier: getUtilization
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double
focal_class.signature: double getUtilization()
focal_class.class_method_signature: LinearCounting.getCount()
focal_class.full_signature: public int getCount()
focal_class.identifier: getCount
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getCount()
focal_class.class_method_signature: LinearCounting.isSaturated()
focal_class.full_signature: public boolean isSaturated()
focal_class.identifier: isSaturated
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isSaturated()
focal_class.class_method_signature: LinearCounting.mapAsBitString()
focal_class.full_signature: protected String mapAsBitString()
focal_class.identifier: mapAsBitString
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String mapAsBitString()
focal_class.class_method_signature: LinearCounting.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: LinearCounting.mergeEstimators(LinearCounting... estimators)
focal_class.full_signature: public static LinearCounting mergeEstimators(LinearCounting... estimators)
focal_class.identifier: mergeEstimators
focal_class.modifiers: public static
focal_class.parameters: (LinearCounting... estimators)
focal_class.return: LinearCounting
focal_class.signature: LinearCounting mergeEstimators(LinearCounting... estimators)
focal_method.body: @Override
      public IRichCardinality merge(IRichCardinality... estimators) throws LinearCountingMergeException
      {
          if (estimators == null) 
          {
              return new LinearCounting(map);
          }
          LinearCounting[] lcs = Arrays.copyOf(estimators, estimators.length + 1, LinearCounting[].class);
          lcs[lcs.length - 1] = this;
          return LinearCounting.mergeEstimators(lcs);
      }
focal_method.class_method_signature: LinearCounting.merge(IRichCardinality... estimators)
focal_method.full_signature: @Override public IRichCardinality merge(IRichCardinality... estimators)
focal_method.identifier: merge
focal_method.invocations: copyOf mergeEstimators
focal_method.modifiers: @Override public
focal_method.parameters: (IRichCardinality... estimators)
focal_method.return: IRichCardinality
focal_method.signature: IRichCardinality merge(IRichCardinality... estimators)