test_class.file: contrib/src/test/java/macrobase/analysis/transform/aggregate/BatchWindowAvgTest.java
test_class.identifier: BatchWindowAvgTest
test_case.body: @Test
      public void testAggregate() throws Exception {
          List<Datum> data = new ArrayList<>();
          for (int i = 0; i < 10; i ++) {
              Datum d = new Datum(new ArrayList<>(), new ArrayRealVector(2));
              d.metrics().setEntry(0, i);
              d.metrics().setEntry(1, 1);
              data.add(d);
          }
  
          BatchWindowAvg windowAvg = new BatchWindowAvg();
          Datum avg = windowAvg.aggregate(data);
          assertEquals(avg.metrics().getEntry(0), 4.5, 1e-5);
          assertEquals(avg.metrics().getEntry(1), 1, 1e-5);
  
          /* Test datum with time column */
          MacroBaseConf conf = new MacroBaseConf().set(MacroBaseConf.TIME_COLUMN, 0);
          windowAvg = new BatchWindowAvg(conf);
          avg = windowAvg.aggregate(data);
          assert(avg.metrics().getEntry(0) == 0);
          assertEquals(avg.metrics().getEntry(1), 1, 1e-5);
      }
test_case.class_method_signature: BatchWindowAvgTest.testAggregate()
test_case.full_signature: @Test public void testAggregate()
test_case.identifier: testAggregate
test_case.invocations: setEntry metrics setEntry metrics add aggregate assertEquals getEntry metrics assertEquals getEntry metrics set aggregate getEntry metrics assertEquals getEntry metrics
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAggregate()
focal_class.file: contrib/src/main/java/macrobase/analysis/transform/aggregate/BatchWindowAvg.java
focal_class.identifier: BatchWindowAvg
focal_class.class_method_signature: BatchWindowAvg.BatchWindowAvg()
focal_class.full_signature: public  BatchWindowAvg()
focal_class.identifier: BatchWindowAvg
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  BatchWindowAvg()
focal_class.class_method_signature: BatchWindowAvg.BatchWindowAvg(MacroBaseConf conf)
focal_class.full_signature: public  BatchWindowAvg(MacroBaseConf conf)
focal_class.identifier: BatchWindowAvg
focal_class.modifiers: public
focal_class.parameters: (MacroBaseConf conf)
focal_class.signature:  BatchWindowAvg(MacroBaseConf conf)
focal_class.class_method_signature: BatchWindowAvg.aggregate(List<Datum> data)
focal_class.full_signature: public Datum aggregate(List<Datum> data)
focal_class.identifier: aggregate
focal_class.modifiers: public
focal_class.parameters: (List<Datum> data)
focal_class.return: Datum
focal_class.signature: Datum aggregate(List<Datum> data)
focal_class.superclass: extends BatchWindowAggregate
focal_method.body: public Datum aggregate(List<Datum> data) {
          if (data.isEmpty())
              return new Datum(new ArrayList<>(), new ArrayRealVector(dim));
  
          dim = data.get(0).metrics().getDimension();
          double[] results = new double[dim];
          for (Datum d : data) {
              RealVector metrics = d.metrics();
              for (int i = 0; i < dim; i ++) {
                  if (timeColumn != null && i == timeColumn)
                      continue;
                  results[i] += metrics.getEntry(i) / data.size();
              }
          }
  
          return new Datum(new ArrayList<>(), new ArrayRealVector(results));
      }
focal_method.class_method_signature: BatchWindowAvg.aggregate(List<Datum> data)
focal_method.full_signature: public Datum aggregate(List<Datum> data)
focal_method.identifier: aggregate
focal_method.invocations: isEmpty getDimension metrics get metrics getEntry size
focal_method.modifiers: public
focal_method.parameters: (List<Datum> data)
focal_method.return: Datum
focal_method.signature: Datum aggregate(List<Datum> data)