Package org.jacoco.core.analysis
Class CoverageNodeImpl
- java.lang.Object
-
- org.jacoco.core.analysis.CoverageNodeImpl
-
- All Implemented Interfaces:
ICoverageNode
- Direct Known Subclasses:
BundleCoverageImpl,PackageCoverageImpl,SourceNodeImpl
public class CoverageNodeImpl extends java.lang.Object implements ICoverageNode
Base implementation for coverage data nodes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jacoco.core.analysis.ICoverageNode
ICoverageNode.CounterEntity, ICoverageNode.ElementType
-
-
Field Summary
Fields Modifier and Type Field Description protected CounterImplbranchCounterCounter for branches.protected CounterImplclassCounterCounter for classes.protected CounterImplcomplexityCounterCounter for complexity.protected CounterImplinstructionCounterCounter for instructions.protected CounterImpllineCounterCounter for linesprotected CounterImplmethodCounterCounter for methods.
-
Constructor Summary
Constructors Constructor Description CoverageNodeImpl(ICoverageNode.ElementType elementType, java.lang.String name)Creates a new coverage data node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsCode()Checks whether this node contains code relevant for code coverage.ICountergetBranchCounter()Returns the counter for branches.ICountergetClassCounter()Returns the counter for classes.ICountergetComplexityCounter()Returns the counter for cyclomatic complexity.ICountergetCounter(ICoverageNode.CounterEntity entity)Generic access to the the counters.ICoverageNode.ElementTypegetElementType()Returns the type of element represented by this node.ICountergetInstructionCounter()Returns the counter for byte code instructions.ICountergetLineCounter()Returns the counter for lines.ICountergetMethodCounter()Returns the counter for methods.java.lang.StringgetName()Returns the name of this node.ICoverageNodegetPlainCopy()Creates a plain copy of this node.voidincrement(java.util.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.java.lang.StringtoString()
-
-
-
Field Detail
-
branchCounter
protected CounterImpl branchCounter
Counter for branches.
-
instructionCounter
protected CounterImpl instructionCounter
Counter for instructions.
-
lineCounter
protected CounterImpl lineCounter
Counter for lines
-
complexityCounter
protected CounterImpl complexityCounter
Counter for complexity.
-
methodCounter
protected CounterImpl methodCounter
Counter for methods.
-
classCounter
protected CounterImpl classCounter
Counter for classes.
-
-
Constructor Detail
-
CoverageNodeImpl
public CoverageNodeImpl(ICoverageNode.ElementType elementType, java.lang.String name)
Creates a new coverage data node.- Parameters:
elementType- type of the element represented by this instancename- name of this node
-
-
Method Detail
-
increment
public void increment(ICoverageNode child)
Increments the counters by the values given by another element.- Parameters:
child- counters to add
-
increment
public void increment(java.util.Collection<? extends ICoverageNode> children)
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
public ICoverageNode.ElementType getElementType()
Description copied from interface:ICoverageNodeReturns the type of element represented by this node.- Specified by:
getElementTypein interfaceICoverageNode- Returns:
- type of this node
-
getName
public java.lang.String getName()
Description copied from interface:ICoverageNodeReturns the name of this node.- Specified by:
getNamein interfaceICoverageNode- Returns:
- name of this node
-
getInstructionCounter
public ICounter getInstructionCounter()
Description copied from interface:ICoverageNodeReturns the counter for byte code instructions.- Specified by:
getInstructionCounterin interfaceICoverageNode- Returns:
- counter for instructions
-
getBranchCounter
public ICounter getBranchCounter()
Description copied from interface:ICoverageNodeReturns the counter for branches.- Specified by:
getBranchCounterin interfaceICoverageNode- Returns:
- counter for branches
-
getLineCounter
public ICounter getLineCounter()
Description copied from interface:ICoverageNodeReturns the counter for lines.- Specified by:
getLineCounterin interfaceICoverageNode- Returns:
- counter for lines
-
getComplexityCounter
public ICounter getComplexityCounter()
Description copied from interface:ICoverageNodeReturns the counter for cyclomatic complexity.- Specified by:
getComplexityCounterin interfaceICoverageNode- Returns:
- counter for complexity
-
getMethodCounter
public ICounter getMethodCounter()
Description copied from interface:ICoverageNodeReturns the counter for methods.- Specified by:
getMethodCounterin interfaceICoverageNode- Returns:
- counter for methods
-
getClassCounter
public ICounter getClassCounter()
Description copied from interface:ICoverageNodeReturns the counter for classes.- Specified by:
getClassCounterin interfaceICoverageNode- Returns:
- counter for classes
-
getCounter
public ICounter getCounter(ICoverageNode.CounterEntity entity)
Description copied from interface:ICoverageNodeGeneric access to the 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
public ICoverageNode 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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-