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

nl.dvberkel.tree.TreeTransformer Maven / Gradle / Ivy

The newest version!
package nl.dvberkel.tree;

public class TreeTransformer {
    private final Configuration configuration;

    public TreeTransformer(Configuration configuration) {
        this.configuration = configuration;
    }

    public SvgTree transform(Tree tree) {
        if (tree == null) { throw new IllegalArgumentException("tree should not be null"); }
        if (tree instanceof Node) {
            Node node = (Node) tree;
            return new SvgNode(configuration, transform(node.left()), transform(node.right()));
        } else {
            return new SvgLeaf(configuration);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy