Package org.jacoco.core.data
Class ExecutionData
java.lang.Object
org.jacoco.core.data.ExecutionData
Execution data for a single Java class. While instances are immutable care
has to be taken about the probe data array of type
boolean[]
which can be modified.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionExecutionData
(long id, String name, boolean[] probes) Creates a newExecutionData
object with the given probe data.ExecutionData
(long id, String name, int probeCount) Creates a newExecutionData
object with the given probe data length. -
Method Summary
Modifier and TypeMethodDescriptionvoid
assertCompatibility
(long id, String name, int probecount) Asserts that this execution data object is compatible with the given parameters.long
getId()
Return the unique identifier for this class.getName()
The VM name of the class.boolean[]
Returns the execution data probes.boolean
hasHits()
Checks whether any probe has been hit.void
merge
(ExecutionData other) Merges the given execution data into the probe data of this object.void
merge
(ExecutionData other, boolean flag) Merges the given execution data into the probe data of this object.void
reset()
Sets all probes tofalse
.toString()
-
Field Details
-
id
private final long id -
name
-
probes
private final boolean[] probes
-
-
Constructor Details
-
ExecutionData
Creates a newExecutionData
object with the given probe data.- Parameters:
id
- class identifiername
- VM nameprobes
- probe data
-
ExecutionData
Creates a newExecutionData
object with the given probe data length. All probes are set tofalse
.- Parameters:
id
- class identifiername
- VM nameprobeCount
- probe count
-
-
Method Details
-
getId
public long getId()Return the unique identifier for this class. The identifier is the CRC64 checksum of the raw class file definition.- Returns:
- class identifier
-
getName
The VM name of the class.- Returns:
- VM name
-
getProbes
public boolean[] getProbes()Returns the execution data probes. A value oftrue
indicates that the corresponding probe was executed.- Returns:
- probe data
-
reset
public void reset()Sets all probes tofalse
. -
hasHits
public boolean hasHits()Checks whether any probe has been hit.- Returns:
true
, if at least one probe has been hit
-
merge
Merges the given execution data into the probe data of this object. I.e. a probe entry in this object is marked as executed (true
) if this probe or the corresponding other probe was executed. So the result isA or B
The probe array of the other object is not modified.- Parameters:
other
- execution data to merge
-
merge
Merges the given execution data into the probe data of this object. A probe in this object is set to the value offlag
if the corresponding other probe was executed. Forflag==true
this corresponds toA or B
Forflag==false
this can be considered as a subtractionA and not B
The probe array of the other object is not modified.- Parameters:
other
- execution data to mergeflag
- merge mode
-
assertCompatibility
Asserts that this execution data object is compatible with the given parameters. The purpose of this check is to detect a very unlikely class id collision.- Parameters:
id
- other class id, must be the samename
- other name, must be equal to this nameprobecount
- probe data length, must be the same as for this data- Throws:
IllegalStateException
- if the given parameters do not match this instance
-
toString
-