@Test public void testGetNumberOfColumns() throws Exception { MarkdownTable mt = new MarkdownTable(); for(int i=0; i<10; i++) { List<MarkdownTableCell> row = mt.addBodyRow(); for(int j=0; j <= i%5; j++) { row.add(new MarkdownTableCell("cell "+j)); } } Assert.assertEquals(5, mt.getNumberOfColumns()); }
public int getNumberOfColumns() { int columns = 0; for(List<MarkdownTableCell> row : this.header) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } for(List<MarkdownTableCell> row : this.body) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } return columns; }
MarkdownTable { public int getNumberOfColumns() { int columns = 0; for(List<MarkdownTableCell> row : this.header) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } for(List<MarkdownTableCell> row : this.body) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } return columns; } }
MarkdownTable { public int getNumberOfColumns() { int columns = 0; for(List<MarkdownTableCell> row : this.header) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } for(List<MarkdownTableCell> row : this.body) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } return columns; } MarkdownTable(); }
MarkdownTable { public int getNumberOfColumns() { int columns = 0; for(List<MarkdownTableCell> row : this.header) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } for(List<MarkdownTableCell> row : this.body) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } return columns; } MarkdownTable(); List<MarkdownTableCell> addHeaderRow(); List<MarkdownTableCell> addBodyRow(); void renderTable(PrintWriter output, boolean allowColspan, boolean renderAsCode); int getNumberOfColumns(); }
MarkdownTable { public int getNumberOfColumns() { int columns = 0; for(List<MarkdownTableCell> row : this.header) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } for(List<MarkdownTableCell> row : this.body) { columns = Math.max(columns, getNumberOfColumnsInRow(row)); } return columns; } MarkdownTable(); List<MarkdownTableCell> addHeaderRow(); List<MarkdownTableCell> addBodyRow(); void renderTable(PrintWriter output, boolean allowColspan, boolean renderAsCode); int getNumberOfColumns();  }