RED-6009: Document Tree Structure
* optimized table access functions
This commit is contained in:
parent
0caa6f571d
commit
560ac1080b
@ -119,13 +119,13 @@ public class TableNode implements SemanticNode {
|
|||||||
|
|
||||||
public Stream<TableCellNode> streamCol(int col) {
|
public Stream<TableCellNode> streamCol(int col) {
|
||||||
|
|
||||||
return streamTableCells().filter(tableCellNode -> tableCellNode.getCol() == col);
|
return IntStream.range(0, numberOfRows).boxed().map(row -> getCell(row, col));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Stream<TableCellNode> streamRow(int row) {
|
public Stream<TableCellNode> streamRow(int row) {
|
||||||
|
|
||||||
return streamTableCells().filter(tableCellNode -> tableCellNode.getRow() == row);
|
return IntStream.range(0, numberOfCols).boxed().map(col -> getCell(row, col));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ public class TableNode implements SemanticNode {
|
|||||||
|
|
||||||
public Stream<TableCellNode> streamHeadersForCell(int row, int col) {
|
public Stream<TableCellNode> streamHeadersForCell(int row, int col) {
|
||||||
|
|
||||||
return streamHeaders().filter(cell -> cell.getRow() == row || cell.getCol() == col);
|
return Stream.concat(streamRow(row), streamCol(col)).filter(TableCellNode::isHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user