@Override public int[] calculateColumnWidths(LinkedList<AT_Row> rows, int colNumbers, int tableWidth) { Validate.notNull(rows); if(colNumbers != (this.ar.length)){ throw new AsciiTableException(this.getClass().getSimpleName() + ": wrong length of columns array", "columns array length must be the same as the columns used to initialize the table, expeced <" + colNumbers + "> found <" + this.ar.length + ">"); } int[] ret = ArrayUtils.addAll(new int[0], this.ar); return ret; }
@Override public int[] calculateColumnWidths(LinkedList<AT_Row> rows, int colNumbers, int tableWidth) { Validate.notNull(rows); if(colNumbers != (this.ar.length)){ throw new AsciiTableException(this.getClass().getSimpleName() + ": wrong length of columns array", "columns array length must be the same as the columns used to initialize the table, expeced <" + colNumbers + "> found <" + this.ar.length + ">"); } int[] ret = ArrayUtils.addAll(new int[0], this.ar); return ret; }
/** * Adds a content row to the table. * For the first content row added, the number of objects given here determines the number of columns in the table. * For every subsequent content row, the array must have an entry for each column, * i.e. the size of the array must be the same as the result of {@link #getColNumber()}. * @param columns content of the columns for the row, must not be null * @return the created row for further customization * @throws {@link NullPointerException} if columns was null * @throws {@link AsciiTableException} if columns does not have the correct size (more or less entries than columns defined for the table) */ public final AT_Row addRow(Object ...columns) throws NullPointerException, AsciiTableException { AT_Row ret = AT_Row.createContentRow(columns, TableRowStyle.NORMAL); if(this.colNumber==0){ this.colNumber = columns.length; } else{ if(columns.length!=this.colNumber){ throw new AsciiTableException("wrong columns argument", "wrong number of columns, expected " + this.colNumber + " received " + columns.length); } } this.rows.add(ret); return ret; }
/** * Adds a content row to the table. * For the first content row added, the number of objects given here determines the number of columns in the table. * For every subsequent content row, the array must have an entry for each column, * i.e. the size of the array must be the same as the result of {@link #getColNumber()}. * @param columns content of the columns for the row, must not be null * @return the created row for further customization * @throws {@link NullPointerException} if columns was null * @throws {@link AsciiTableException} if columns does not have the correct size (more or less entries than columns defined for the table) */ public final AT_Row addRow(Object ...columns) throws NullPointerException, AsciiTableException { AT_Row ret = AT_Row.createContentRow(columns, TableRowStyle.NORMAL); if(this.colNumber==0){ this.colNumber = columns.length; } else{ if(columns.length!=this.colNumber){ throw new AsciiTableException("wrong columns argument", "wrong number of columns, expected " + this.colNumber + " received " + columns.length); } } this.rows.add(ret); return ret; }
break; case UNKNOWN: throw new AsciiTableException("AT_Renderer: cannot render unknown row style", "table row style set to 'unknown'"); default: throw new AsciiTableException("AT_Renderer: cannot render unknown row style", "table row style not specified or type not processed"); LinkedList<AT_Cell> cells = row.getCells(); if(cells==null){ throw new AsciiTableException("cannot render table", "row content (cells) was null"); break; case UNKNOWN: throw new AsciiTableException("AT_Renderer: cannot render unknown row type", "table row type set to 'unknown'"); default: throw new AsciiTableException("AT_Renderer: cannot render unknown row type", "table row type not specified or type not processed");
break; case UNKNOWN: throw new AsciiTableException("AT_Renderer: cannot render unknown row style", "table row style set to 'unknown'"); default: throw new AsciiTableException("AT_Renderer: cannot render unknown row style", "table row style not specified or type not processed"); LinkedList<AT_Cell> cells = row.getCells(); if(cells==null){ throw new AsciiTableException("cannot render table", "row content (cells) was null"); break; case UNKNOWN: throw new AsciiTableException("AT_Renderer: cannot render unknown row type", "table row type set to 'unknown'"); default: throw new AsciiTableException("AT_Renderer: cannot render unknown row type", "table row type not specified or type not processed");