org.jacoco.core.analysis
Class CoverageBuilder

java.lang.Object
  extended by org.jacoco.core.analysis.CoverageBuilder
All Implemented Interfaces:
IStructureVisitor

public class CoverageBuilder
extends Object
implements IStructureVisitor

Builder for hierarchical ICoverageNode structures based on execution and structure information. The builder is constructed for a given ExecutionDataStore and then feed with class structure information through its IStructureVisitor interface. Afterwards the collected data can be obtained with getClasses(), getSourceFiles() or getBundle(String).

Version:
$Revision: $
Author:
Marc R. Hoffmann

Constructor Summary
CoverageBuilder(ExecutionDataStore executionData)
          Create a new builder based on the given execution data.
 
Method Summary
 BundleCoverage getBundle(String name)
          Creates a bundle from all nodes currently contained in this bundle.
 Collection<ClassCoverage> getClasses()
          Returns all class nodes currently contained in this builder.
 Collection<SourceFileCoverage> getSourceFiles()
          Returns all source file nodes currently contained in this builder.
 IClassStructureVisitor visitClassStructure(long id, String name)
          Provides structural information about a class as collected during instrumentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoverageBuilder

public CoverageBuilder(ExecutionDataStore executionData)
Create a new builder based on the given execution data.

Parameters:
executionData - execution data
Method Detail

getClasses

public Collection<ClassCoverage> getClasses()
Returns all class nodes currently contained in this builder.

Returns:
all class nodes

getSourceFiles

public Collection<SourceFileCoverage> getSourceFiles()
Returns all source file nodes currently contained in this builder.

Returns:
all source file nodes

getBundle

public BundleCoverage getBundle(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

visitClassStructure

public IClassStructureVisitor visitClassStructure(long id,
                                                  String name)
Description copied from interface: IStructureVisitor
Provides structural information about a class as collected during instrumentation.

Specified by:
visitClassStructure in interface IStructureVisitor
Parameters:
id - unique id for the class
name - VM name of the class
Returns:
call-back for structure details about the class