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 extends O> root;
public RootChecker(SnapshotManager manager,
Class objectClass,
LocatedObject extends O> root) {
super(manager,
objectClass);
this.root = root;
}
@SafeVarargs
public RootChecker(SnapshotManager manager,
Class objectClass,
LocatedObject extends O> root,
AbstractChecker super O>... checkers) {
this(manager,
objectClass,
root);
for (final AbstractChecker super O> 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 super O> child : getComponents()) {
child.print(out, level + 1);
}
}
}