use of gherkin.formatter.model.Row in project cucumber-jvm by cucumber.
the class DataTable method transpose.
public DataTable transpose() {
List<List<String>> transposed = new ArrayList<List<String>>();
for (int i = 0; i < gherkinRows.size(); i++) {
Row gherkinRow = gherkinRows.get(i);
for (int j = 0; j < gherkinRow.getCells().size(); j++) {
List<String> row = null;
if (j < transposed.size()) {
row = transposed.get(j);
}
if (row == null) {
row = new ArrayList<String>();
transposed.add(row);
}
row.add(gherkinRow.getCells().get(j));
}
}
return new DataTable(this.gherkinRows, transposed, this.tableConverter);
}
use of gherkin.formatter.model.Row in project cucumber-jvm by cucumber.
the class CucumberScenarioOutline method rowsWithTokensReplaced.
private static List<DataTableRow> rowsWithTokensReplaced(List<DataTableRow> rows, List<String> headerCells, List<String> exampleCells, Set<Integer> matchedColumns) {
if (rows != null) {
List<DataTableRow> newRows = new ArrayList<DataTableRow>(rows.size());
for (Row row : rows) {
List<String> newCells = new ArrayList<String>(row.getCells().size());
for (String cell : row.getCells()) {
newCells.add(replaceTokens(matchedColumns, headerCells, exampleCells, cell));
}
newRows.add(new DataTableRow(row.getComments(), newCells, row.getLine()));
}
return newRows;
} else {
return null;
}
}
Aggregations