Class CoverageNodeImpl
java.lang.Object
org.jacoco.core.analysis.CoverageNodeImpl
- All Implemented Interfaces:
ICoverageNode
- Direct Known Subclasses:
BundleCoverageImpl, PackageCoverageImpl, SourceNodeImpl
Base implementation for coverage data nodes.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ICoverageNode
ICoverageNode.CounterEntity, ICoverageNode.ElementType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CounterImplCounter for branches.protected CounterImplCounter for classes.protected CounterImplCounter for complexity.private final ICoverageNode.ElementTypeprotected CounterImplCounter for instructions.protected CounterImplCounter for linesprotected CounterImplCounter for methods.private final String -
Constructor Summary
ConstructorsConstructorDescriptionCoverageNodeImpl(ICoverageNode.ElementType elementType, String name) Creates a new coverage data node. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether this node contains code relevant for code coverage.Returns the counter for branches.Returns the counter for classes.Returns the counter for cyclomatic complexity.Generic access to the counters.Returns the type of element represented by this node.Returns the counter for byte code instructions.Returns the counter for lines.Returns the counter for methods.getName()Returns the name of this node.Creates a plain copy of this node.voidincrement(Collection<? extends ICoverageNode> children) Increments the counters by the values given by the collection of elements.voidincrement(ICoverageNode child) Increments the counters by the values given by another element.toString()
-
Field Details
-
elementType
-
name
-
branchCounter
Counter for branches. -
instructionCounter
Counter for instructions. -
lineCounter
Counter for lines -
complexityCounter
Counter for complexity. -
methodCounter
Counter for methods. -
classCounter
Counter for classes.
-
-
Constructor Details
-
CoverageNodeImpl
Creates a new coverage data node.- Parameters:
elementType- type of the element represented by this instancename- name of this node
-
-
Method Details
-
increment
Increments the counters by the values given by another element.- Parameters:
child- counters to add
-
increment
Increments the counters by the values given by the collection of elements.- Parameters:
children- list of nodes, which counters will be added to this node
-
getElementType
Description copied from interface:ICoverageNodeReturns the type of element represented by this node.- Specified by:
getElementTypein interfaceICoverageNode- Returns:
- type of this node
-
getName
Description copied from interface:ICoverageNodeReturns the name of this node.- Specified by:
getNamein interfaceICoverageNode- Returns:
- name of this node
-
getInstructionCounter
Description copied from interface:ICoverageNodeReturns the counter for byte code instructions.- Specified by:
getInstructionCounterin interfaceICoverageNode- Returns:
- counter for instructions
-
getBranchCounter
Description copied from interface:ICoverageNodeReturns the counter for branches.- Specified by:
getBranchCounterin interfaceICoverageNode- Returns:
- counter for branches
-
getLineCounter
Description copied from interface:ICoverageNodeReturns the counter for lines.- Specified by:
getLineCounterin interfaceICoverageNode- Returns:
- counter for lines
-
getComplexityCounter
Description copied from interface:ICoverageNodeReturns the counter for cyclomatic complexity.- Specified by:
getComplexityCounterin interfaceICoverageNode- Returns:
- counter for complexity
-
getMethodCounter
Description copied from interface:ICoverageNodeReturns the counter for methods.- Specified by:
getMethodCounterin interfaceICoverageNode- Returns:
- counter for methods
-
getClassCounter
Description copied from interface:ICoverageNodeReturns the counter for classes.- Specified by:
getClassCounterin interfaceICoverageNode- Returns:
- counter for classes
-
getCounter
Description copied from interface:ICoverageNodeGeneric access to the counters.- Specified by:
getCounterin interfaceICoverageNode- Parameters:
entity- entity we're we want to have the counter for- Returns:
- counter for the given entity
-
containsCode
public boolean containsCode()Description copied from interface:ICoverageNodeChecks whether this node contains code relevant for code coverage.- Specified by:
containsCodein interfaceICoverageNode- Returns:
trueif this node contains code relevant for code coverage
-
getPlainCopy
Description copied from interface:ICoverageNodeCreates a plain copy of this node. WhileICoverageNodeimplementations may contain heavy data structures, the copy returned by this method is reduced to the counters only. This helps to save memory while processing huge structures.- Specified by:
getPlainCopyin interfaceICoverageNode- Returns:
- copy with counters only
-
toString
-