void (@NotNull ArrangementMatchingRulesControl control, @NotNull List<int[]> mappings) { IntList rows = control.getSelectedModelRows(); rows.sort(IntComparators.OPPOSITE_COMPARATOR); int top = -1; for (int i = 0; i < rows.size(); i++) { int row = rows.getInt(i); if (row == top + 1) { mappings.add(new int[] { row, row }); top++; } else { mappings.add(new int[]{ row, row - 1 }); } } }