test_class.file: dataprep-transformation/src/test/java/org/talend/dataprep/transformation/aggregation/operation/SumTest.java
test_class.identifier: SumTest
test_class.superclass: extends OperationBaseTest
test_case.body: @Test
      public void shouldComputeSum() {
          // given when
          AggregationResult result = new AggregationResult(Operator.SUM);
          aggregator.accept(getRow("toto", "514.3"), result);
          aggregator.accept(getRow("toto", "0"), result);
          aggregator.accept(getRow("toto", ""), result);
          aggregator.accept(getRow("toto", "-786.25"), result);
          aggregator.accept(getRow("toto", "235874"), result);
          aggregator.accept(getRow("toto", "-8760"), result);
  
          // then
          Assert.assertEquals(result.get("toto").getValue(), 226842.05, 0);
  
      }
test_case.class_method_signature: SumTest.shouldComputeSum()
test_case.full_signature: @Test public void shouldComputeSum()
test_case.identifier: shouldComputeSum
test_case.invocations: accept getRow accept getRow accept getRow accept getRow accept getRow accept getRow assertEquals getValue get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldComputeSum()
focal_class.file: dataprep-transformation/src/main/java/org/talend/dataprep/transformation/aggregation/operation/Sum.java
focal_class.identifier: Sum
focal_class.interfaces: implements Aggregator
focal_class.class_method_signature: Sum.Sum(String groupBy, String columnId)
focal_class.full_signature:   Sum(String groupBy, String columnId)
focal_class.identifier: Sum
focal_class.parameters: (String groupBy, String columnId)
focal_class.signature:  Sum(String groupBy, String columnId)
focal_class.class_method_signature: Sum.accept(DataSetRow row, AggregationResult result)
focal_class.full_signature: @Override public void accept(DataSetRow row, AggregationResult result)
focal_class.identifier: accept
focal_class.modifiers: @Override public
focal_class.parameters: (DataSetRow row, AggregationResult result)
focal_class.return: void
focal_class.signature: void accept(DataSetRow row, AggregationResult result)
focal_class.class_method_signature: Sum.normalize(AggregationResult result)
focal_class.full_signature: @Override public void normalize(AggregationResult result)
focal_class.identifier: normalize
focal_class.modifiers: @Override public
focal_class.parameters: (AggregationResult result)
focal_class.return: void
focal_class.signature: void normalize(AggregationResult result)
focal_class.superclass: extends AbstractAggregator
focal_method.body: @Override
      public void accept(DataSetRow row, AggregationResult result) {
          final String sumKey = row.get(groupBy);
  
          // skip value not found
          if (StringUtils.isEmpty(sumKey)) {
              return;
          }
  
          // get the value
          double toAdd;
          try {
              toAdd = Double.parseDouble(row.get(columnId));
          } catch (NumberFormatException e) {
              // skip non number
              return;
          }
  
          // init the group by in the result
          if (!result.contains(sumKey)) {
              result.put(sumKey, new NumberContext(0d));
          }
  
          NumberContext context = (NumberContext) result.get(sumKey);
          context.setValue(context.getValue() + toAdd);
  
      }
focal_method.class_method_signature: Sum.accept(DataSetRow row, AggregationResult result)
focal_method.full_signature: @Override public void accept(DataSetRow row, AggregationResult result)
focal_method.identifier: accept
focal_method.invocations: get isEmpty parseDouble get contains put get setValue getValue
focal_method.modifiers: @Override public
focal_method.parameters: (DataSetRow row, AggregationResult result)
focal_method.return: void
focal_method.signature: void accept(DataSetRow row, AggregationResult result)