• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // BEGIN android-change
2 package org.jacoco.core.data;
3 
4 /**
5  * Interface for interacting with execution data for a single Java class.
6  */
7 public interface IExecutionData {
8 
9 	/**
10 	 * Return the unique identifier for this class. The identifier is the CRC64
11 	 * checksum of the raw class file definition.
12 	 *
13 	 * @return class identifier
14 	 */
getId()15 	public abstract long getId();
16 
17 	/**
18 	 * The VM name of the class.
19 	 *
20 	 * @return VM name
21 	 */
getName()22 	public abstract String getName();
23 
24 	/**
25 	 * The number of instrumentation probes for this class.
26 	 *
27 	 * @return number of probes
28 	 */
getProbeCount()29 	public abstract int getProbeCount();
30 
31 	/**
32 	 * Returns a copy of the probe data as a boolean array.
33 	 *
34 	 * Changes to the returned array will not be reflected in the execution data.
35 	 *
36 	 * @return copy of the probe data
37 	 */
getProbesCopy()38 	public abstract boolean[] getProbesCopy();
39 
40 	/**
41 	 * Sets all probes to <code>false</code>.
42 	 */
reset()43 	public abstract void reset();
44 
45 	/**
46 	 * Checks whether any probe has been hit.
47 	 *
48 	 * @return <code>true</code>, if at least one probe has been hit
49 	 */
hasHits()50 	public abstract boolean hasHits();
51 
52 	/**
53 	 * Merges the given execution data into the probe data of this object. I.e.
54 	 * a probe entry in this object is marked as executed (<code>true</code>) if
55 	 * this probe or the corresponding other probe was executed. So the result
56 	 * is
57 	 *
58 	 * <pre>
59 	 * A or B
60 	 * </pre>
61 	 *
62 	 * The probe array of the other object is not modified.
63 	 *
64 	 * @param other
65 	 *            execution data to merge
66 	 */
merge(final IExecutionData other)67 	public abstract void merge(final IExecutionData other);
68 
69 	/**
70 	 * Merges the given execution data into the probe data of this object. A
71 	 * probe in this object is set to the value of <code>flag</code> if the
72 	 * corresponding other probe was executed. For <code>flag==true</code> this
73 	 * corresponds to
74 	 *
75 	 * <pre>
76 	 * A or B
77 	 * </pre>
78 	 *
79 	 * For <code>flag==false</code> this can be considered as a subtraction
80 	 *
81 	 * <pre>
82 	 * A and not B
83 	 * </pre>
84 	 *
85 	 * The probe array of the other object is not modified.
86 	 *
87 	 * @param other
88 	 *            execution data to merge
89 	 * @param flag
90 	 *            merge mode
91 	 */
merge(final IExecutionData other, boolean flag)92 	public abstract void merge(final IExecutionData other, boolean flag);
93 
94 	/**
95 	 * Asserts that this execution data object is compatible with the given
96 	 * parameters. The purpose of this check is to detect a very unlikely class
97 	 * id collision.
98 	 *
99 	 * @param id
100 	 *            other class id, must be the same
101 	 * @param name
102 	 *            other name, must be equal to this name
103 	 * @param probecount
104 	 *            probe data length, must be the same as for this data
105 	 * @throws IllegalStateException
106 	 *             if the given parameters do not match this instance
107 	 */
assertCompatibility(final long id, final String name, final int probeCount)108 	public abstract void assertCompatibility(final long id, final String name, final int probeCount) throws IllegalStateException;
109 
110 	/**
111 	 * Returns the execution data probe for a given index. A value of
112 	 * <code>true</code> indicates that the corresponding probe was
113 	 * executed.
114 	 *
115 	 * @param index  the probe's index to look up
116 	 *
117 	 * @return probe data
118 	 */
getProbe(final int index)119 	public abstract boolean getProbe(final int index);
120 
121 	/**
122 	 * Sets the execution data probe at the given index to <code>true</code>.
123 	 *
124 	 * @param index  the probe's index to set
125 	 * @param value  the value to set the probe to
126 	 */
setProbe(final int index)127 	public abstract void setProbe(final int index);
128 }
129 // END android-change
130