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

com.ui4j.api.util.NodeVisitor Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package com.ui4j.api.util;

import com.ui4j.api.dom.Element;
import com.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