Class SourceNodeImpl
java.lang.Object
org.jacoco.core.analysis.CoverageNodeImpl
org.jacoco.core.internal.analysis.SourceNodeImpl
- All Implemented Interfaces:
ICoverageNode, ISourceNode
- Direct Known Subclasses:
ClassCoverageImpl, MethodCoverageImpl, SourceFileCoverageImpl
Implementation of
ISourceNode.-
Nested Class Summary
Nested classes/interfaces inherited from interface ICoverageNode
ICoverageNode.CounterEntity, ICoverageNode.ElementType -
Field Summary
FieldsFields inherited from class CoverageNodeImpl
branchCounter, classCounter, complexityCounter, instructionCounter, lineCounter, methodCounterFields inherited from interface ISourceNode
UNKNOWN_LINE -
Constructor Summary
ConstructorsConstructorDescriptionSourceNodeImpl(ICoverageNode.ElementType elementType, String name) Create a new source node implementation instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidensureCapacity(int first, int last) Make sure that the internal buffer can keep lines from first to last.intThe number of the first line coverage information is available for.intThe number of the last line coverage information is available for.getLine(int nr) Returns the line information for given line.voidIncrements instructions and branches by the given counter values.voidincrement(ISourceNode child) Increments all counters by the values of the given child.private voidincrementLine(ICounter instructions, ICounter branches, int line) Methods inherited from class CoverageNodeImpl
containsCode, getBranchCounter, getClassCounter, getComplexityCounter, getCounter, getElementType, getInstructionCounter, getLineCounter, getMethodCounter, getName, getPlainCopy, increment, increment, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ICoverageNode
containsCode, getBranchCounter, getClassCounter, getComplexityCounter, getCounter, getElementType, getInstructionCounter, getLineCounter, getMethodCounter, getName, getPlainCopy
-
Field Details
-
lines
-
offset
private int offsetfirst line number inlines
-
-
Constructor Details
-
SourceNodeImpl
Create a new source node implementation instance.- Parameters:
elementType- element typename- name of the element
-
-
Method Details
-
ensureCapacity
public void ensureCapacity(int first, int last) Make sure that the internal buffer can keep lines from first to last. While the buffer is also incremented automatically, this method allows optimization in case the total range is known in advance.- Parameters:
first- first line number orISourceNode.UNKNOWN_LINElast- last line number orISourceNode.UNKNOWN_LINE
-
increment
Increments all counters by the values of the given child. When incrementing the line counter it is assumed that the child refers to the same source file.- Parameters:
child- child node to add
-
increment
Increments instructions and branches by the given counter values. If a optional line number is specified the instructions and branches are added to the given line. The line counter is incremented accordingly.- Parameters:
instructions- instructions to addbranches- branches to addline- optional line number orISourceNode.UNKNOWN_LINE
-
incrementLine
-
getFirstLine
public int getFirstLine()Description copied from interface:ISourceNodeThe number of the first line coverage information is available for. If no line is contained, the method returns -1.- Specified by:
getFirstLinein interfaceISourceNode- Returns:
- number of the first line or
ISourceNode.UNKNOWN_LINE
-
getLastLine
public int getLastLine()Description copied from interface:ISourceNodeThe number of the last line coverage information is available for. If no line is contained, the method returns -1.- Specified by:
getLastLinein interfaceISourceNode- Returns:
- number of the last line or
ISourceNode.UNKNOWN_LINE
-
getLine
Description copied from interface:ISourceNodeReturns the line information for given line.- Specified by:
getLinein interfaceISourceNode- Parameters:
nr- line number of interest- Returns:
- line information
-