Package org.jacoco.core.analysis

## Class CoverageBuilder

- java.lang.Object
- - org.jacoco.core.analysis.CoverageBuilder

All Implemented Interfaces:
  `ICoverageVisitor`

    public class CoverageBuilder
    extends java.lang.Object
    implements ICoverageVisitor

Builder for hierarchical `ICoverageNode` structures from single `IClassCoverage` nodes. The nodes are feed into the builder through its `ICoverageVisitor` interface. Afterwards the aggregated data can be obtained with `getClasses()`, `getSourceFiles()` or `getBundle(String)` in the following hierarchy:

     IBundleCoverage
     +-- IPackageCoverage*
         +-- IClassCoverage*
         +-- ISourceFileCoverage*

### Constructor Summary

Constructors
`CoverageBuilder()` Create a new builder.

### Method Summary

All Methods Instance Methods Concrete Methods
`IBundleCoverage` `getBundle​(java.lang.String name)` Creates a bundle from all nodes currently contained in this bundle.
`java.util.Collection<IClassCoverage>` `getClasses()` Returns all class nodes currently contained in this builder.
`java.util.Collection<IClassCoverage>` `getNoMatchClasses()` Returns all classes for which execution data does not match.
`java.util.Collection<ISourceFileCoverage>` `getSourceFiles()` Returns all source file nodes currently contained in this builder.
`void` `visitCoverage​(IClassCoverage coverage)` For analyzed class coverage data is emitted to this method.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### CoverageBuilder

    public CoverageBuilder()

Create a new builder.

### Method Detail

#### getClasses

    public java.util.Collection<IClassCoverage> getClasses()

Returns all class nodes currently contained in this builder.

Returns:
  all class nodes

#### getSourceFiles

    public java.util.Collection<ISourceFileCoverage> getSourceFiles()

Returns all source file nodes currently contained in this builder.

Returns:
  all source file nodes

#### getBundle

    public IBundleCoverage getBundle​(java.lang.String name)

Creates a bundle from all nodes currently contained in this bundle.

Parameters:
  `name` - Name of the bundle
Returns:
  bundle containing all classes and source files

#### getNoMatchClasses

    public java.util.Collection<IClassCoverage> getNoMatchClasses()

Returns all classes for which execution data does not match.

Returns:
  collection of classes with non-matching execution data
See Also:
  `IClassCoverage.isNoMatch()`

#### visitCoverage

    public void visitCoverage​(IClassCoverage coverage)

Description copied from interface: `ICoverageVisitor`
For analyzed class coverage data is emitted to this method.

Specified by:
  `visitCoverage` in interface `ICoverageVisitor`
Parameters:
  `coverage` - coverage data for a class