public void calculateCell(String cellRef) { this.row = 1; this.col = 1; final Pattern pattern = Pattern.compile(PATTERN); final Matcher matcher = pattern.matcher(cellRef); if (matcher.find()) { String col = matcher.group(1); if (col != null) this.col = Cell.colToIntIndex(col); else this.col = Cell.BOUNDARY; String row = matcher.group(2); if (row != null) this.row = Integer.parseInt(row); else this.row = Cell.BOUNDARY; } }
public static Cell parse(String reference) { Cell cell = new Cell(); cell.calculateCell(reference); return cell; }