Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/LineLocationToProbeCollectionMap.java @ 16873:3ad18f453679
Truffle/Instrumentation: Javadoc
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Wed, 20 Aug 2014 15:14:30 -0700 |
parents | 7bfbad29d331 |
children | f0e3b50c29c8 |
comparison
equal
deleted
inserted
replaced
16872:ce8ac92efb14 | 16873:3ad18f453679 |
---|---|
32 /** | 32 /** |
33 * A mapping from {@link LineLocation} (a line number in a specific piece of {@link Source} code) to | 33 * A mapping from {@link LineLocation} (a line number in a specific piece of {@link Source} code) to |
34 * a collection of {@link Probe}s whose associated {@link SourceSection} starts on that line. | 34 * a collection of {@link Probe}s whose associated {@link SourceSection} starts on that line. |
35 */ | 35 */ |
36 public class LineLocationToProbeCollectionMap implements ProbeListener { | 36 public class LineLocationToProbeCollectionMap implements ProbeListener { |
37 | |
37 /** | 38 /** |
38 * Map: Source line ==> probes associated with source sections starting on the line. | 39 * Map: Source line ==> probes associated with source sections starting on the line. |
39 */ | 40 */ |
40 private final Map<LineLocation, Collection<Probe>> lineToProbesMap = new HashMap<>(); | 41 private final Map<LineLocation, Collection<Probe>> lineToProbesMap = new HashMap<>(); |
41 | 42 |
67 } | 68 } |
68 return probe; | 69 return probe; |
69 } | 70 } |
70 | 71 |
71 /** | 72 /** |
72 * Adds a probe to the given line. | 73 * Records creation of a probe whose associated source starts on the given line. |
73 * <p> | 74 * <p> |
74 * If the line already exists in the internal {@link #lineToProbesMap}, this probe will be added | 75 * If the line already exists in the internal {@link #lineToProbesMap}, this probe will be added |
75 * to the existing collection. If no line already exists in the internal map, then a new key is | 76 * to the existing collection. If no line already exists in the internal map, then a new key is |
76 * added along with a new collection containing the probe. | 77 * added along with a new collection containing the probe. |
77 * <p> | 78 * <p> |
95 existingProbeList.add(probe); | 96 existingProbeList.add(probe); |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
99 /** | 100 /** |
100 * Returns a collection of {@link Probe}s at the given {@link LineLocation}. If there are no | 101 * Returns a collection of {@link Probe}s whose associated source begings at the given |
101 * probes at that line, an empty list is returned. | 102 * {@link LineLocation}. If there are no probes at that line, an empty list is returned. |
102 * | 103 * |
103 * @param line The line to check. | 104 * @param line The line to check. |
104 * @return A iterable collection of probes at the given line. | 105 * @return A collection of probes at the given line. |
105 */ | 106 */ |
106 private Collection<Probe> getProbesAtLine(LineLocation line) { | 107 private Collection<Probe> getProbesAtLine(LineLocation line) { |
107 Collection<Probe> probeList = lineToProbesMap.get(line); | 108 Collection<Probe> probeList = lineToProbesMap.get(line); |
108 | 109 |
109 if (probeList == null) | 110 if (probeList == null) |