Move TreeVisitor, and document it
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/TreeVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
similarity index 64%
rename from javaparser-core/src/main/java/com/github/javaparser/ast/TreeVisitor.java
rename to javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
index f3b2672..94eac0b 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/TreeVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
@@ -18,18 +18,27 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
-
-package com.github.javaparser.ast;
+package com.github.javaparser.ast.visitor;
+
+import com.github.javaparser.ast.Node;
+
+/**
+ * Iterate over all the nodes in (a part of) the AST.
+ */
public abstract class TreeVisitor {
- public void visitDepthFirst(Node node){
- process(node);
- for (Node child : node.getChildrenNodes()){
- visitDepthFirst(child);
- }
- }
+ /**
+ * https://en.wikipedia.org/wiki/Depth-first_search
+ *
+ * @param node the start node, and the first one that is passed to process(node).
+ */
+ public void visitDepthFirst(Node node) {
+ process(node);
+ for (Node child : node.getChildrenNodes()) {
+ visitDepthFirst(child);
+ }
+ }
- public abstract void process(Node node);
-
+ public abstract void process(Node node);
}