org.jacoco.core.data
Class ExecutionData

java.lang.Object
  extended by org.jacoco.core.data.ExecutionData

public final class ExecutionData
extends Object

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.


Constructor Summary
ExecutionData(long id, String name, boolean[] probes)
          Creates a new ExecutionData object with the given probe data.
ExecutionData(long id, String name, int probeCount)
          Creates a new ExecutionData object with the given probe data length.
 
Method Summary
 void 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.
 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 to false.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExecutionData

public ExecutionData(long id,
                     String name,
                     boolean[] probes)
Creates a new ExecutionData object with the given probe data.

Parameters:
id - class identifier
name - VM name
probes - probe data

ExecutionData

public ExecutionData(long id,
                     String name,
                     int probeCount)
Creates a new ExecutionData object with the given probe data length. All probes are set to false.

Parameters:
id - class identifier
name - VM name
probeCount - 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 String getName()
The VM name of the class.

Returns:
VM name

getProbes

public boolean[] getProbes()
Returns the execution data probes. A value of true indicates that the corresponding probe was executed.

Returns:
probe data

reset

public void reset()
Sets all probes to false.


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 is
 A 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 of flag if the corresponding other probe was executed. For flag==true this corresponds to
 A or B
 
For flag==false this can be considered as a subtraction
 A and not B
 
The probe array of the other object is not modified.

Parameters:
other - execution data to merge
flag - merge mode

assertCompatibility

public void assertCompatibility(long id,
                                String name,
                                int probecount)
                         throws 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 same
name - other name, must be equal to this name
probecount - probe data length, must be the same as for this data
Throws:
IllegalStateException - if the given parameters do not match this instance

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009–2023 Mountainminds GmbH & Co. KG. All rights reserved.