Blame view

src/kernel/function/Sum.java 449 Bytes
2e8fbd04   Remi   global refactor
1
2
3
  package kernel.function;
  
  import kernel.Cell;
94ba86ff   Remi   Auto stash before...
4
  import kernel.LanguageEnum;
2e8fbd04   Remi   global refactor
5
  
94ba86ff   Remi   Auto stash before...
6
  import java.util.List;
2e8fbd04   Remi   global refactor
7
8
9
  
  public class Sum extends Function {
  
94ba86ff   Remi   Auto stash before...
10
11
12
13
      public Sum(List<Cell> listCells) {
          super(listCells);
          this.names.put(LanguageEnum.FR, "SOMME");
          this.names.put(LanguageEnum.EN, "SUM");
2e8fbd04   Remi   global refactor
14
15
16
17
18
19
20
21
      }
  
      public Double eval() {
          return this.listCells.stream()
                  .mapToDouble(Cell::getValue)
                  .sum();
      }
  }