@Test public void testFromRange() { RangeCoordinate coordinate = RangeCoordinate.fromRange(range); Assert.assertEquals(rowStartIndex, coordinate.getRowStartIndex()); Assert.assertEquals(rowEndIndex, coordinate.getRowEndIndex()); Assert.assertEquals(columnStartIndex, coordinate.getColumnStartIndex()); Assert.assertEquals(columnEndIndex, coordinate.getColumnEndIndex()); }
public static RangeCoordinate fromRange(String range) { RangeCoordinate coordinate = new RangeCoordinate(); String rangeExpression = normalizeRange(range); if (rangeExpression.contains(":")) { String[] coordinates = rangeExpression.split(":", -1); coordinate.setRowStartIndex(getRowIndex(coordinates[0])); coordinate.setColumnStartIndex(getColumnIndex(coordinates[0])); coordinate.setRowEndIndex(getRowIndex(coordinates[1]) + 1); coordinate.setColumnEndIndex(getColumnIndex(coordinates[1]) + 1); } else { CellCoordinate cellCoordinate = CellCoordinate.fromCellId(rangeExpression); coordinate.setRowIndex(cellCoordinate.getRowIndex()); coordinate.setColumnIndex(cellCoordinate.getColumnIndex()); coordinate.setRowStartIndex(cellCoordinate.getRowIndex()); coordinate.setColumnStartIndex(cellCoordinate.getColumnIndex()); coordinate.setRowEndIndex(cellCoordinate.getRowIndex() + 1); coordinate.setColumnEndIndex(cellCoordinate.getColumnIndex() + 1); } return coordinate; }
RangeCoordinate extends CellCoordinate { public static RangeCoordinate fromRange(String range) { RangeCoordinate coordinate = new RangeCoordinate(); String rangeExpression = normalizeRange(range); if (rangeExpression.contains(":")) { String[] coordinates = rangeExpression.split(":", -1); coordinate.setRowStartIndex(getRowIndex(coordinates[0])); coordinate.setColumnStartIndex(getColumnIndex(coordinates[0])); coordinate.setRowEndIndex(getRowIndex(coordinates[1]) + 1); coordinate.setColumnEndIndex(getColumnIndex(coordinates[1]) + 1); } else { CellCoordinate cellCoordinate = CellCoordinate.fromCellId(rangeExpression); coordinate.setRowIndex(cellCoordinate.getRowIndex()); coordinate.setColumnIndex(cellCoordinate.getColumnIndex()); coordinate.setRowStartIndex(cellCoordinate.getRowIndex()); coordinate.setColumnStartIndex(cellCoordinate.getColumnIndex()); coordinate.setRowEndIndex(cellCoordinate.getRowIndex() + 1); coordinate.setColumnEndIndex(cellCoordinate.getColumnIndex() + 1); } return coordinate; } }
RangeCoordinate extends CellCoordinate { public static RangeCoordinate fromRange(String range) { RangeCoordinate coordinate = new RangeCoordinate(); String rangeExpression = normalizeRange(range); if (rangeExpression.contains(":")) { String[] coordinates = rangeExpression.split(":", -1); coordinate.setRowStartIndex(getRowIndex(coordinates[0])); coordinate.setColumnStartIndex(getColumnIndex(coordinates[0])); coordinate.setRowEndIndex(getRowIndex(coordinates[1]) + 1); coordinate.setColumnEndIndex(getColumnIndex(coordinates[1]) + 1); } else { CellCoordinate cellCoordinate = CellCoordinate.fromCellId(rangeExpression); coordinate.setRowIndex(cellCoordinate.getRowIndex()); coordinate.setColumnIndex(cellCoordinate.getColumnIndex()); coordinate.setRowStartIndex(cellCoordinate.getRowIndex()); coordinate.setColumnStartIndex(cellCoordinate.getColumnIndex()); coordinate.setRowEndIndex(cellCoordinate.getRowIndex() + 1); coordinate.setColumnEndIndex(cellCoordinate.getColumnIndex() + 1); } return coordinate; } private  RangeCoordinate(); }
RangeCoordinate extends CellCoordinate { public static RangeCoordinate fromRange(String range) { RangeCoordinate coordinate = new RangeCoordinate(); String rangeExpression = normalizeRange(range); if (rangeExpression.contains(":")) { String[] coordinates = rangeExpression.split(":", -1); coordinate.setRowStartIndex(getRowIndex(coordinates[0])); coordinate.setColumnStartIndex(getColumnIndex(coordinates[0])); coordinate.setRowEndIndex(getRowIndex(coordinates[1]) + 1); coordinate.setColumnEndIndex(getColumnIndex(coordinates[1]) + 1); } else { CellCoordinate cellCoordinate = CellCoordinate.fromCellId(rangeExpression); coordinate.setRowIndex(cellCoordinate.getRowIndex()); coordinate.setColumnIndex(cellCoordinate.getColumnIndex()); coordinate.setRowStartIndex(cellCoordinate.getRowIndex()); coordinate.setColumnStartIndex(cellCoordinate.getColumnIndex()); coordinate.setRowEndIndex(cellCoordinate.getRowIndex() + 1); coordinate.setColumnEndIndex(cellCoordinate.getColumnIndex() + 1); } return coordinate; } private  RangeCoordinate(); static RangeCoordinate fromRange(String range); String getColumnNames(); int getRowStartIndex(); void setRowStartIndex(int rowStartIndex); int getRowEndIndex(); void setRowEndIndex(int rowEndIndex); int getColumnStartIndex(); void setColumnStartIndex(int columnStartIndex); int getColumnEndIndex(); void setColumnEndIndex(int columnEndIndex); }
RangeCoordinate extends CellCoordinate { public static RangeCoordinate fromRange(String range) { RangeCoordinate coordinate = new RangeCoordinate(); String rangeExpression = normalizeRange(range); if (rangeExpression.contains(":")) { String[] coordinates = rangeExpression.split(":", -1); coordinate.setRowStartIndex(getRowIndex(coordinates[0])); coordinate.setColumnStartIndex(getColumnIndex(coordinates[0])); coordinate.setRowEndIndex(getRowIndex(coordinates[1]) + 1); coordinate.setColumnEndIndex(getColumnIndex(coordinates[1]) + 1); } else { CellCoordinate cellCoordinate = CellCoordinate.fromCellId(rangeExpression); coordinate.setRowIndex(cellCoordinate.getRowIndex()); coordinate.setColumnIndex(cellCoordinate.getColumnIndex()); coordinate.setRowStartIndex(cellCoordinate.getRowIndex()); coordinate.setColumnStartIndex(cellCoordinate.getColumnIndex()); coordinate.setRowEndIndex(cellCoordinate.getRowIndex() + 1); coordinate.setColumnEndIndex(cellCoordinate.getColumnIndex() + 1); } return coordinate; } private  RangeCoordinate(); static RangeCoordinate fromRange(String range); String getColumnNames(); int getRowStartIndex(); void setRowStartIndex(int rowStartIndex); int getRowEndIndex(); void setRowEndIndex(int rowEndIndex); int getColumnStartIndex(); void setColumnStartIndex(int columnStartIndex); int getColumnEndIndex(); void setColumnEndIndex(int columnEndIndex); static final String DIMENSION_ROWS; static final String DIMENSION_COLUMNS; }