Package org.jacoco.core.data
Class ExecutionData
- java.lang.Object
-
- org.jacoco.core.data.ExecutionData
-
public final class ExecutionData extends java.lang.Object
Execution data for a single Java class. While instances are immutable care has to be taken about the probe data array of typeboolean[]
which can be modified.
-
-
Constructor Summary
Constructors Constructor Description ExecutionData(long id, java.lang.String name, boolean[] probes)
Creates a newExecutionData
object with the given probe data.ExecutionData(long id, java.lang.String name, int probeCount)
Creates a newExecutionData
object with the given probe data length.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertCompatibility(long id, java.lang.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.java.lang.String
getName()
The VM name of the class.boolean[]
getProbes()
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
.java.lang.String
toString()
-
-
-
Constructor Detail
-
ExecutionData
public ExecutionData(long id, java.lang.String name, boolean[] probes)
Creates a newExecutionData
object with the given probe data.- Parameters:
id
- class identifiername
- VM nameprobes
- probe data
-
ExecutionData
public ExecutionData(long id, java.lang.String name, int probeCount)
Creates a newExecutionData
object with the given probe data length. All probes are set tofalse
.- Parameters:
id
- class identifiername
- VM nameprobeCount
- probe count
-
-
Method Detail
-
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
public java.lang.String 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
public void merge(ExecutionData other)
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
public void merge(ExecutionData other, boolean flag)
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
public void assertCompatibility(long id, java.lang.String name, int probecount) throws java.lang.IllegalStateException
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:
java.lang.IllegalStateException
- if the given parameters do not match this instance
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-