org.jacoco.core.data
Class ExecutionDataStore

java.lang.Object
  extended by org.jacoco.core.data.ExecutionDataStore
All Implemented Interfaces:
IExecutionDataVisitor

public class ExecutionDataStore
extends Object
implements IExecutionDataVisitor

In-memory data store for execution data. The data can be added through its IExecutionDataVisitor interface. If execution data is provided multiple times for the same class the data is merged, i.e. a block is marked as executed if it is reported as executed at least once. This allows to merge coverage date from multiple runs. A instance of this class is not thread safe.

Version:
$Revision: $
Author:
Marc R. Hoffmann

Constructor Summary
ExecutionDataStore()
           
 
Method Summary
 void accept(IExecutionDataVisitor visitor)
          Writes the content of the store to the given visitor interface.
 boolean[] getData(long classid)
          Returns the coverage data for the class with the given identifier if available.
 boolean[] getData(Long classid)
          Returns the coverage data for the class with the given identifier if available.
 boolean[] getData(Long classid, String name, int probecount)
          Returns the coverage date for the class with the given identifier.
 String getName(long classid)
          Returns the vm name of the class with the given id.
 String getName(Long classid)
          Returns the vm name of the class with the given id.
 void put(long classid, String name, boolean[] data)
          Adds the given block data structure into the store.
 void put(Long classid, String name, boolean[] data)
          Adds the given block data structure into the store.
 void reset()
          Resets all execution data structures, i.e. marks them as not executed.
 void visitClassExecution(long classid, String name, boolean[] data)
          Provides execution data for the class with the given id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionDataStore

public ExecutionDataStore()
Method Detail

put

public void put(Long classid,
                String name,
                boolean[] data)
Adds the given block data structure into the store. If there is already a data structure for this class ID, this structure is merged with the given one. In this case a IllegalStateException is thrown, if both executions data structure do have different sizes or the name is different.

Parameters:
classid - unique class identifier
name - VM name of the class
data - execution data

put

public void put(long classid,
                String name,
                boolean[] data)
Adds the given block data structure into the store. If there is already a data structure for this class ID, this structure is merged with the given one. In this case a IllegalStateException is thrown, if both executions data structure do have different sizes or the name is different.

Parameters:
classid - unique class identifier
name - VM name of the class
data - execution data

getData

public boolean[] getData(Long classid)
Returns the coverage data for the class with the given identifier if available.

Parameters:
classid - class identifier
Returns:
coverage data or null

getData

public boolean[] getData(long classid)
Returns the coverage data for the class with the given identifier if available.

Parameters:
classid - class identifier
Returns:
coverage data or null

getData

public boolean[] getData(Long classid,
                         String name,
                         int probecount)
Returns the coverage date for the class with the given identifier. If there is not data available under the given id a new entry is created.

Parameters:
classid - class identifier
name - VM name of the class
probecount - probe array length
Returns:
execution data

getName

public String getName(Long classid)
Returns the vm name of the class with the given id.

Parameters:
classid - class identifier
Returns:
vm name or null

getName

public String getName(long classid)
Returns the vm name of the class with the given id.

Parameters:
classid - class identifier
Returns:
vm name or null

reset

public void reset()
Resets all execution data structures, i.e. marks them as not executed. The data structures itself are not deleted.


accept

public void accept(IExecutionDataVisitor visitor)
Writes the content of the store to the given visitor interface.

Parameters:
visitor - interface to write content to

visitClassExecution

public void visitClassExecution(long classid,
                                String name,
                                boolean[] data)
Description copied from interface: IExecutionDataVisitor
Provides execution data for the class with the given id. Each slot in the array represents a probe in the instrumented class. A value of true indicates that a probe has been executed.

Specified by:
visitClassExecution in interface IExecutionDataVisitor
Parameters:
classid - id of the class
name - VM name of the class
data - coverage data for the class