Returns database statistics for the path nodes that will result from this path. @return statistics or null
()
| 397 | * @return statistics or {@code null} |
| 398 | */ |
| 399 | public ArrayList<Stats> pathStats() { |
| 400 | final ArrayList<PathNode> nodes = pathNodes(root, true); |
| 401 | if(nodes == null) return null; |
| 402 | |
| 403 | // loop through all nodes |
| 404 | final ArrayList<Stats> stats = new ArrayList<>(); |
| 405 | for(PathNode node : nodes) { |
| 406 | // retrieve text child if addressed node is an element |
| 407 | if(node.kind == Data.ELEM) { |
| 408 | if(!node.stats.isLeaf()) return null; |
| 409 | for(final PathNode nd : node.children) { |
| 410 | if(nd.kind == Data.TEXT) node = nd; |
| 411 | } |
| 412 | } |
| 413 | // skip nodes others than texts and attributes |
| 414 | // check if distinct values are available |
| 415 | final int kind = node.kind; |
| 416 | if(kind != Data.TEXT && kind != Data.ATTR) return null; |
| 417 | stats.add(node.stats); |
| 418 | } |
| 419 | return stats; |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * Checks if the path contains empty steps. |