All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.webfolder.ui4j.api.util.NodeVisitor Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
package io.webfolder.ui4j.api.util;

import io.webfolder.ui4j.api.dom.Element;
import io.webfolder.ui4j.api.dom.Node;

public abstract class NodeVisitor {

    private Node root;

    public NodeVisitor(Node root) {
        if (root == null) {
            return;
        }
        this.root = root;
    }

    public void walk() {
        walk(root);
    }

    public abstract void visit(Node child);

    private void walk(Node node) {
        for (Element next : node.getChildren()) {
            if (next.hasChildNodes()) {
                walk(next);
            }
            visit(next);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy