MCPcopy Create free account
hub / github.com/RealTimeGenomics/rtg-tools / addRow

Method addRow

src/main/java/com/rtg/util/TextTable.java:154–175  ·  view source on GitHub ↗

Add a row of entries to the table Each row must be the same length and contain no nulls @param cells the cells to add

(String... cells)

Source from the content-addressed store, hash-verified

152 * @param cells the cells to add
153 */
154 public void addRow(String... cells) {
155 if (mTableContents.size() > 0 && mTableContents.get(0).size() != cells.length) {
156 throw new SlimException("Mismatching number of columns in table formatter");
157 }
158 if (cells.length < mAlignment.length) {
159 throw new SlimException("Too many alignment values supplied for number of columns supplied in row");
160 }
161 if (mColumnWidths == null) {
162 mColumnWidths = new int[cells.length];
163 }
164 final ArrayList<String> cellList = new ArrayList<>(cells.length);
165 int col = 0;
166 for (final String cell : cells) {
167 if (cell == null) {
168 throw new SlimException("Null provided as value in table formatters");
169 }
170 cellList.add(cell);
171 mColumnWidths[col] = Math.max(mColumnWidths[col], cell.length());
172 ++col;
173 }
174 mTableContents.add(cellList);
175 }
176
177 /**
178 * Add a separator line to the table.

Callers 7

testDefaultMethod · 0.95
testIndentMethod · 0.95
testErrorsMethod · 0.95
writeSummaryMethod · 0.95
mainExecMethod · 0.95
addHeaderRowMethod · 0.95

Calls 5

getMethod · 0.65
addMethod · 0.65
lengthMethod · 0.65
sizeMethod · 0.45
maxMethod · 0.45

Tested by 4

testDefaultMethod · 0.76
testIndentMethod · 0.76
testErrorsMethod · 0.76