Returns all children or descendants of the specified nodes. Called by the query parser and optimizer. @param nodes input nodes @param desc if false, return only children @return descendant nodes
(final ArrayList<PathNode> nodes, final boolean desc)
| 155 | * @return descendant nodes |
| 156 | */ |
| 157 | public static ArrayList<PathNode> desc(final ArrayList<PathNode> nodes, final boolean desc) { |
| 158 | final ArrayList<PathNode> list = new ArrayList<>(); |
| 159 | for(final PathNode node : nodes) { |
| 160 | for(final PathNode child : node.children) { |
| 161 | if(desc) child.addDesc(list); |
| 162 | else if(!list.contains(child)) list.add(child); |
| 163 | } |
| 164 | } |
| 165 | return list; |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Returns all descendants with the specified element name. |
no test coverage detected