@Test public void testTraverseChildren() { root.traverseChildren( l -> { if (l.get(0).equals(a)) { grandchildrenSeen = true; } }); assertTrue(grandchildrenSeen); }
public void traverseChildren(Consumer<List<ParseTreeNode>> consumer) { if (children != null && !children.isEmpty()) { consumer.accept(children); children.forEach(c -> c.traverseChildren(consumer)); } }
ParseTreeNode { public void traverseChildren(Consumer<List<ParseTreeNode>> consumer) { if (children != null && !children.isEmpty()) { consumer.accept(children); children.forEach(c -> c.traverseChildren(consumer)); } } }
ParseTreeNode { public void traverseChildren(Consumer<List<ParseTreeNode>> consumer) { if (children != null && !children.isEmpty()) { consumer.accept(children); children.forEach(c -> c.traverseChildren(consumer)); } } ParseTreeNode(PhraseChunk chunk);  ParseTreeNode(List<ParseTreeNode> children); }
ParseTreeNode { public void traverseChildren(Consumer<List<ParseTreeNode>> consumer) { if (children != null && !children.isEmpty()) { consumer.accept(children); children.forEach(c -> c.traverseChildren(consumer)); } } ParseTreeNode(PhraseChunk chunk);  ParseTreeNode(List<ParseTreeNode> children); void traverseChildren(Consumer<List<ParseTreeNode>> consumer); void traverseParent(BiPredicate<ParseTreeNode, ParseTreeNode> consumer); boolean isRoot(); PhraseChunk getChunk(); void setParent(ParseTreeNode parent); List<ParseTreeNode> getChildren(); boolean hasChildren(); ParseTreeNode getParent(); void addChild(ParseTreeNode child); void addWords(Collection<WordToken> word); List<WordToken> getWords(); @Override String toString(); boolean containsWord(Predicate<WordToken> filter); void log(String indent); }
ParseTreeNode { public void traverseChildren(Consumer<List<ParseTreeNode>> consumer) { if (children != null && !children.isEmpty()) { consumer.accept(children); children.forEach(c -> c.traverseChildren(consumer)); } } ParseTreeNode(PhraseChunk chunk);  ParseTreeNode(List<ParseTreeNode> children); void traverseChildren(Consumer<List<ParseTreeNode>> consumer); void traverseParent(BiPredicate<ParseTreeNode, ParseTreeNode> consumer); boolean isRoot(); PhraseChunk getChunk(); void setParent(ParseTreeNode parent); List<ParseTreeNode> getChildren(); boolean hasChildren(); ParseTreeNode getParent(); void addChild(ParseTreeNode child); void addWords(Collection<WordToken> word); List<WordToken> getWords(); @Override String toString(); boolean containsWord(Predicate<WordToken> filter); void log(String indent);  }