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

cdc.issues.checks.RootChecker Maven / Gradle / Ivy

The newest version!
package cdc.issues.checks;

import java.io.PrintStream;

import cdc.issues.locations.LocatedObject;
import cdc.util.debug.Printables;

public class RootChecker extends CompositeChecker {
    private final LocatedObject root;

    public RootChecker(SnapshotManager manager,
                       Class objectClass,
                       LocatedObject root) {
        super(manager,
              objectClass);
        this.root = root;
    }

    @SafeVarargs
    public RootChecker(SnapshotManager manager,
                       Class objectClass,
                       LocatedObject root,
                       AbstractChecker... checkers) {
        this(manager,
             objectClass,
             root);
        for (final AbstractChecker checker : checkers) {
            add(checker);
        }
    }

    public final void check() {
        check(CheckContext.EMPTY.push(root), root);
    }

    @Override
    public void print(PrintStream out,
                      int level) {
        Printables.indent(out, level);
        out.println("ROOT<" + getObjectClass().getSimpleName() + ">");
        for (final AbstractChecker child : getComponents()) {
            child.print(out, level + 1);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy