+
+ public int getRow() {
+ return row;
+ }
+
+ public SpreadsheetLine possibleOffset(int offset) {
+ return getEngine().getLine(row+offset);
+ }
+
+ public SpreadsheetCell cellAt(int column) {
+ int index = Collections.binarySearch(cells, new BinarySearch(column), new Comparator<BinarySearch>() {
+ @Override
+ public int compare(BinarySearch bs1, BinarySearch bs2) {
+ return Integer.compare(bs1.column, bs2.column);
+ }
+ });
+ if(index >= 0)
+ return cells.get(index);
+ else
+ return null;
+ }
+
+ public String getLinesPath() {
+ return "/" + ((SpreadsheetLines)parent).getLinesPath() + "/" + getName();
+ }
+
+ public void forCells(Consumer<SpreadsheetCell> consumer, int min, int max) {
+ for(int i=min;i<cells.size() && i<max;i++) {
+ SpreadsheetCell cell = cells.get(i);
+ if(SpreadsheetCell.EMPTY == cell) continue;
+ consumer.accept(cell);
+ }
+ }
+
+ public List<SpreadsheetCell> getCells(int min, int max) {
+ ArrayList<SpreadsheetCell> result = new ArrayList<>();
+ forCells(cell -> result.add(cell), min, max);
+ return result;
+ }