[
https://issues.apache.org/jira/browse/GROOVY-7486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14624798#comment-14624798
]
ASF GitHub Bot commented on GROOVY-7486:
----------------------------------------
Github user keeganwitt commented on a diff in the pull request:
https://github.com/apache/incubator-groovy/pull/59#discussion_r34475088
--- Diff: src/main/groovy/util/Node.java ---
@@ -537,26 +539,40 @@ private NodeList getByName(String name) {
/**
* Provides a collection of all the nodes in the tree
- * using a depth first traversal.
+ * using a depth-first preorder traversal.
*
* @return the list of (depth-first) ordered nodes
*/
public List depthFirst() {
+ return depthFirst(true);
+ }
+
+ /**
+ * Provides a collection of all the nodes in the tree
+ * using a depth-first traversal.
+ *
+ * @param preorder if false, a postorder depth-first traversal will be
performed
--- End diff --
You'd traverse the tree (traversal type doesn't matter), adding each node
to a TreeSet, then return a List of the TreeSet. Kinda funky, I'm not sure
it's a good idea. It's just the only way I could think of to offer in-order
traversal for non-binary trees.
> In groovy.util.Node.depthFirst please Provide a way to Specify In-order,
> pre-order, post-order Ordering
> -------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-7486
> URL: https://issues.apache.org/jira/browse/GROOVY-7486
> Project: Groovy
> Issue Type: Improvement
> Components: groovy-jdk
> Reporter: Suminda Dharmasena
> Priority: Minor
>
> Please provide a way to specify the ordering in depth 1st traversal.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)