public String graphicalToString(CellMatrix<E> matrix) { int width = matrix.getWidth(); int height = matrix.getHeight(); StringBuilder graphic = new StringBuilder(); appendFirstRow(graphic, width); for (int y = 0; y < height - 1; y++) { appendContentRow(graphic, y, width, matrix); appendDelimiterRow(graphic, width); } appendContentRow(graphic, height - 1, width, matrix); appendLastRow(graphic, width); return graphic.toString(); }
private String appendCellContent(CellMatrix<E> matrix, int x, int y) { E cell = matrix.getCell(x, y); return cell != null ? getFormatter(cell).format(cell) : " " + style.getUndefined() + " "; }