test_class.file: singa-mathematics/src/test/java/bio/singa/mathematics/algorithms/topology/FloodFillTest.java
test_class.identifier: FloodFillTest
test_case.body: @Test
      void shouldFillCentre() {
          // initialize
          RectangularGrid<Integer> grid = new RectangularGrid<>(10, 10);
          for (int row = 0; row < 10; row++) {
              for (int col = 0; col < 10; col++) {
                  if (row == 2 || row == 7 || col == 2 || col == 7) {
                      grid.setValue(col, row, 1);
                  } else {
                      grid.setValue(col, row, 0);
                  }
              }
          }
          // fill with twos
          FloodFill.fill(grid, new RectangularCoordinate(4, 4), value -> value.equals(1), position -> grid.setValue(position, 2), value -> value.equals(2));
          // assert
          Integer two = 2;
          for (int row = 3; row < 7; row++) {
              for (int col = 3; col < 7; col++) {
                  assertEquals(grid.getValue(col,row), two);
              }
          }
  
      }
test_case.class_method_signature: FloodFillTest.shouldFillCentre()
test_case.full_signature: @Test void shouldFillCentre()
test_case.identifier: shouldFillCentre
test_case.invocations: setValue setValue fill equals setValue equals assertEquals getValue
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldFillCentre()
focal_class.file: singa-mathematics/src/main/java/bio/singa/mathematics/algorithms/topology/FloodFill.java
focal_class.identifier: FloodFill
focal_class.class_method_signature: FloodFill.fill(DiscreteGrid<ValueType, DirectionType, CoordinateType> grid,
                CoordinateType pourPosition,
                Predicate<ValueType> wallPredicate,
                Consumer<CoordinateType> replacementConsumer,
                Predicate<ValueType> recurrencePredicate)
focal_class.full_signature: public static void fill(DiscreteGrid<ValueType, DirectionType, CoordinateType> grid,
                CoordinateType pourPosition,
                Predicate<ValueType> wallPredicate,
                Consumer<CoordinateType> replacementConsumer,
                Predicate<ValueType> recurrencePredicate)
focal_class.identifier: fill
focal_class.modifiers: public static
focal_class.parameters: (DiscreteGrid<ValueType, DirectionType, CoordinateType> grid,
                CoordinateType pourPosition,
                Predicate<ValueType> wallPredicate,
                Consumer<CoordinateType> replacementConsumer,
                Predicate<ValueType> recurrencePredicate)
focal_class.return: void
focal_class.signature: void fill(DiscreteGrid<ValueType, DirectionType, CoordinateType> grid,
                CoordinateType pourPosition,
                Predicate<ValueType> wallPredicate,
                Consumer<CoordinateType> replacementConsumer,
                Predicate<ValueType> recurrencePredicate)
focal_method.body: public static <ValueType, DirectionType extends DiscreteDirection, CoordinateType extends DiscreteCoordinate<CoordinateType, DirectionType>>
      void fill(DiscreteGrid<ValueType, DirectionType, CoordinateType> grid,
                CoordinateType pourPosition,
                Predicate<ValueType> wallPredicate,
                Consumer<CoordinateType> replacementConsumer,
                Predicate<ValueType> recurrencePredicate) {
          // sorry for the generics
          ValueType value = grid.getValue(pourPosition);
          // not already processed
          if (recurrencePredicate.test(value)) {
              return;
          }
          // not wall
          if (wallPredicate.test(value)) {
              return;
          }
          // apply replacement
          replacementConsumer.accept(pourPosition);
          // flow to neighbours
          for (CoordinateType coordinate : pourPosition.getListOfNeighbours()) {
              if (grid.isInRange(coordinate)) {
                  fill(grid, coordinate, wallPredicate, replacementConsumer, recurrencePredicate);
              }
          }
      }
focal_method.class_method_signature: FloodFill.fill(DiscreteGrid<ValueType, DirectionType, CoordinateType> grid,
                CoordinateType pourPosition,
                Predicate<ValueType> wallPredicate,
                Consumer<CoordinateType> replacementConsumer,
                Predicate<ValueType> recurrencePredicate)
focal_method.full_signature: public static void fill(DiscreteGrid<ValueType, DirectionType, CoordinateType> grid,
                CoordinateType pourPosition,
                Predicate<ValueType> wallPredicate,
                Consumer<CoordinateType> replacementConsumer,
                Predicate<ValueType> recurrencePredicate)
focal_method.identifier: fill
focal_method.invocations: getValue test test accept getListOfNeighbours isInRange fill
focal_method.modifiers: public static
focal_method.parameters: (DiscreteGrid<ValueType, DirectionType, CoordinateType> grid,
                CoordinateType pourPosition,
                Predicate<ValueType> wallPredicate,
                Consumer<CoordinateType> replacementConsumer,
                Predicate<ValueType> recurrencePredicate)
focal_method.return: void
focal_method.signature: void fill(DiscreteGrid<ValueType, DirectionType, CoordinateType> grid,
                CoordinateType pourPosition,
                Predicate<ValueType> wallPredicate,
                Consumer<CoordinateType> replacementConsumer,
                Predicate<ValueType> recurrencePredicate)