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 org.jacoco.core.analysis.ICoverageNode
ICoverageNode.CounterEntity, ICoverageNode.ElementType
-
Field Summary
FieldsFields inherited from class org.jacoco.core.analysis.CoverageNodeImpl
branchCounter, classCounter, complexityCounter, instructionCounter, lineCounter, methodCounter
Fields inherited from interface org.jacoco.core.analysis.ISourceNode
UNKNOWN_LINE
-
Constructor Summary
ConstructorsConstructorDescriptionSourceNodeImpl
(ICoverageNode.ElementType elementType, String name) Create a new source node implementation instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
ensureCapacity
(int first, int last) Make sure that the internal buffer can keep lines from first to last.int
The number of the first line coverage information is available for.int
The number of the last line coverage information is available for.getLine
(int nr) Returns the line information for given line.void
Increments instructions and branches by the given counter values.void
increment
(ISourceNode child) Increments all counters by the values of the given child.private void
incrementLine
(ICounter instructions, ICounter branches, int line) Methods inherited from class org.jacoco.core.analysis.CoverageNodeImpl
containsCode, getBranchCounter, getClassCounter, getComplexityCounter, getCounter, getElementType, getInstructionCounter, getLineCounter, getMethodCounter, getName, getPlainCopy, increment, increment, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jacoco.core.analysis.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_LINE
last
- 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:ISourceNode
The number of the first line coverage information is available for. If no line is contained, the method returns -1.- Specified by:
getFirstLine
in interfaceISourceNode
- Returns:
- number of the first line or
ISourceNode.UNKNOWN_LINE
-
getLastLine
public int getLastLine()Description copied from interface:ISourceNode
The number of the last line coverage information is available for. If no line is contained, the method returns -1.- Specified by:
getLastLine
in interfaceISourceNode
- Returns:
- number of the last line or
ISourceNode.UNKNOWN_LINE
-
getLine
Description copied from interface:ISourceNode
Returns the line information for given line.- Specified by:
getLine
in interfaceISourceNode
- Parameters:
nr
- line number of interest- Returns:
- line information
-