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

Method getAsTsv

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

Output the table as basic tab separated @return the TSV representation

()

Source from the content-addressed store, hash-verified

249 * @return the <code>TSV</code> representation
250 */
251 public String getAsTsv() {
252 final StringBuilder sb = new StringBuilder();
253 for (int i = 0; i < mTableContents.size(); ++i) {
254 final ArrayList<String> row = mTableContents.get(i);
255 if (row != SEPARATOR) {
256 final boolean isHeader = mHeaderRows.get(i);
257 if (isHeader && mHeaderTsvPrefix != null) {
258 sb.append(mHeaderTsvPrefix);
259 }
260 boolean first = true;
261 for (String column : row) {
262 if (!first) {
263 sb.append("\t");
264 }
265 first = false;
266 sb.append(isHeader ? sanitizeHeaderCell(column) : column);
267 }
268 sb.append(StringUtils.LS);
269 }
270 }
271 return sb.toString();
272 }
273
274 protected String sanitizeHeaderCell(String cell) {
275 return cell.replaceAll("\\s", "_");

Callers 1

testDefaultMethod · 0.95

Calls 5

sanitizeHeaderCellMethod · 0.95
getMethod · 0.65
appendMethod · 0.65
toStringMethod · 0.65
sizeMethod · 0.45

Tested by 1

testDefaultMethod · 0.76