code: protected void processGrid( int cols, int rows, boolean ignoreBorder, Calculator calculator ) throws Exception {
          ExecutionPlanner planner = createDefaultPlanner();
          planner.setNumberOfTasks(rows * cols);
  
          int startC = 0;
          int startR = 0;
          int endC = cols;
          int endR = rows;
          if (ignoreBorder) {
              startC = 1;
              startR = 1;
              endC = cols - 1;
              endR = rows - 1;
          }
          for( int r = startR; r < endR; r++ ) {
              for( int c = startC; c < endC; c++ ) {
                  int _c = c, _r = r;
                  planner.submit(() -> {
                      if (!pm.isCanceled()) {
                          calculator.calculate(_c, _r);
                      }
                  });
              }
          }
          planner.join();
      }
docs: Loops through all rows and cols of the given grid.