Class MethodCoverageCalculator
java.lang.Object
org.jacoco.core.internal.analysis.MethodCoverageCalculator
- All Implemented Interfaces:
IFilterOutput
Calculates the filtered coverage of a single method. A instance of this class
can be first used as
IFilterOutput
before the coverage result is
calculated.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Set<org.objectweb.asm.tree.AbstractInsnNode>
private final Map<org.objectweb.asm.tree.AbstractInsnNode,
Instruction> private final Map<org.objectweb.asm.tree.AbstractInsnNode,
org.objectweb.asm.tree.AbstractInsnNode> Instructions that should be merged form disjoint sets.private final Map<org.objectweb.asm.tree.AbstractInsnNode,
Set<org.objectweb.asm.tree.AbstractInsnNode>> -
Constructor Summary
ConstructorsConstructorDescriptionMethodCoverageCalculator
(Map<org.objectweb.asm.tree.AbstractInsnNode, Instruction> instructions) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private void
(package private) void
calculate
(MethodCoverageImpl coverage) Applies all specified filtering commands and calculates the resulting coverage.private void
ensureCapacity
(MethodCoverageImpl coverage) private org.objectweb.asm.tree.AbstractInsnNode
findRepresentative
(org.objectweb.asm.tree.AbstractInsnNode i) void
ignore
(org.objectweb.asm.tree.AbstractInsnNode fromInclusive, org.objectweb.asm.tree.AbstractInsnNode toInclusive) Marks sequence of instructions that should be ignored during computation of coverage.void
merge
(org.objectweb.asm.tree.AbstractInsnNode i1, org.objectweb.asm.tree.AbstractInsnNode i2) Marks two instructions that should be merged during computation of coverage.void
replaceBranches
(org.objectweb.asm.tree.AbstractInsnNode source, Set<org.objectweb.asm.tree.AbstractInsnNode> newTargets) Marks instruction whose outgoing branches should be replaced during computation of coverage.
-
Field Details
-
instructions
-
ignored
-
merged
private final Map<org.objectweb.asm.tree.AbstractInsnNode,org.objectweb.asm.tree.AbstractInsnNode> mergedInstructions that should be merged form disjoint sets. Coverage information from instructions of one set will be merged into representative instruction of set. Each such set is represented as a singly linked list: each element except one references another element from the same set, element without reference - is a representative of this set. This map stores reference (value) for elements of sets (key). -
replacements
-
-
Constructor Details
-
MethodCoverageCalculator
MethodCoverageCalculator(Map<org.objectweb.asm.tree.AbstractInsnNode, Instruction> instructions)
-
-
Method Details
-
calculate
Applies all specified filtering commands and calculates the resulting coverage.- Parameters:
coverage
- the result is added to this coverage node
-
applyMerges
private void applyMerges() -
applyReplacements
private void applyReplacements() -
ensureCapacity
-
findRepresentative
private org.objectweb.asm.tree.AbstractInsnNode findRepresentative(org.objectweb.asm.tree.AbstractInsnNode i) -
ignore
public void ignore(org.objectweb.asm.tree.AbstractInsnNode fromInclusive, org.objectweb.asm.tree.AbstractInsnNode toInclusive) Description copied from interface:IFilterOutput
Marks sequence of instructions that should be ignored during computation of coverage.- Specified by:
ignore
in interfaceIFilterOutput
- Parameters:
fromInclusive
- first instruction that should be ignored, inclusivetoInclusive
- last instruction coming afterfromInclusive
that should be ignored, inclusive
-
merge
public void merge(org.objectweb.asm.tree.AbstractInsnNode i1, org.objectweb.asm.tree.AbstractInsnNode i2) Description copied from interface:IFilterOutput
Marks two instructions that should be merged during computation of coverage.- Specified by:
merge
in interfaceIFilterOutput
- Parameters:
i1
- first instructioni2
- second instruction
-
replaceBranches
public void replaceBranches(org.objectweb.asm.tree.AbstractInsnNode source, Set<org.objectweb.asm.tree.AbstractInsnNode> newTargets) Description copied from interface:IFilterOutput
Marks instruction whose outgoing branches should be replaced during computation of coverage.- Specified by:
replaceBranches
in interfaceIFilterOutput
- Parameters:
source
- instruction which branches should be replacednewTargets
- new targets of branches
-