package org.gcube.informationsystem.utils.documentation.rst.table; import java.util.ArrayList; import java.util.List; /** * @author Luca Frosini (ISTI - CNR) */ public class Table { public static final String COLUMN_SEPARATOR_IN_SEPERATOR_ROW = "+"; public static final String COLUMN_SEPARATOR_IN_CONTENT_ROW = "|"; public static final String ROW_SEPARATOR = "-"; public static final String ROW_SEPARATOR_HEADING = "="; private List rows; private List maxSizePerCell; public Table() { rows = new ArrayList<>(); maxSizePerCell = new ArrayList<>(); } protected void updateMaxSizePerCell(Row row) { List cellSizes = row.getCellSizes(); for(int i=0; i=maxSize) { maxSizePerCell.set(i, cellSize); } } catch (IndexOutOfBoundsException e) { maxSizePerCell.add(i, cellSize); } } } public void appendRow(Row row) { rows.add(row); row.setRowPosition(rows.size()-1); row.setTable(this); updateMaxSizePerCell(row); } private StringBuffer addRowSeparator(String separator) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("\t"); stringBuffer.append(COLUMN_SEPARATOR_IN_SEPERATOR_ROW); for(int i=0; i0 && cell==row.getCell(i-1)) { for(int j=0; j