aboutsummaryrefslogtreecommitdiffstats
path: root/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
diff options
context:
space:
mode:
Diffstat (limited to 'javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java')
-rw-r--r--javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java59
1 files changed, 30 insertions, 29 deletions
diff --git a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
index 8358a65a7..04497d706 100644
--- a/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
+++ b/javaparser-core/src/main/java/com/github/javaparser/ast/visitor/TreeVisitor.java
@@ -22,6 +22,7 @@
package com.github.javaparser.ast.visitor;
import com.github.javaparser.ast.Node;
+
import java.util.LinkedList;
import java.util.Queue;
@@ -30,34 +31,34 @@ import java.util.Queue;
*/
public abstract class TreeVisitor {
- /**
- * 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.getChildNodes()) {
- visitDepthFirst(child);
- }
- }
-
- /**
- * https://en.wikipedia.org/wiki/Breadth-first_search
- *
- * @param node the start node, and the first one that is passed to process(node).
- */
- public void visitBreadthFirst(Node node) {
- Queue<Node> queue = new LinkedList<>();
- queue.offer(node);
- while (queue.size() > 0) {
- Node head = queue.peek();
- for (Node child : head.getChildNodes()) {
- queue.offer(child);
- }
- process(queue.poll());
- }
- }
+ /**
+ * 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.getChildNodes()) {
+ visitDepthFirst(child);
+ }
+ }
+
+ /**
+ * https://en.wikipedia.org/wiki/Breadth-first_search
+ *
+ * @param node the start node, and the first one that is passed to process(node).
+ */
+ public void visitBreadthFirst(Node node) {
+ Queue<Node> queue = new LinkedList<>();
+ queue.offer(node);
+ while (queue.size() > 0) {
+ Node head = queue.peek();
+ for (Node child : head.getChildNodes()) {
+ queue.offer(child);
+ }
+ process(queue.poll());
+ }
+ }
- public abstract void process(Node node);
+ public abstract void process(Node node);
}