/** * Creates package node instance for a package with the given name. * * @param name vm name of the package * @param classes collection of all classes in this package * @param sourceFiles collection of all source files in this package */ public PackageCoverageImpl( final String name, final Collection<IClassCoverage> classes, final Collection<ISourceFileCoverage> sourceFiles) { super(ElementType.PACKAGE, name); this.classes = classes; this.sourceFiles = sourceFiles; increment(sourceFiles); for (final IClassCoverage c : classes) { // We need to add only classes without a source file reference. // Classes associated with a source file are already included in the // SourceFileCoverage objects. if (c.getSourceFileName() == null) { increment(c); } } }
public void visitCoverage(final IClassCoverage coverage) { out.printf("class name: %s%n", coverage.getName()); out.printf("class id: %016x%n", Long.valueOf(coverage.getId())); out.printf( "instructions: %s%n", Integer.valueOf(coverage.getInstructionCounter().getTotalCount())); out.printf("branches: %s%n", Integer.valueOf(coverage.getBranchCounter().getTotalCount())); out.printf("lines: %s%n", Integer.valueOf(coverage.getLineCounter().getTotalCount())); out.printf("methods: %s%n", Integer.valueOf(coverage.getMethodCounter().getTotalCount())); out.printf( "complexity: %s%n%n", Integer.valueOf(coverage.getComplexityCounter().getTotalCount())); }