Class LineToProbesMap
- All Implemented Interfaces:
Probe.ProbeListener
LineLocation
(a line number in a specific piece of Source
code) to
a collection of Probe
s whose associated SourceSection
starts on that line.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addProbeToLine
(LineLocation line, Probe probe) Records creation of a probe whose associated source starts on the given line.void
endASTProbing
(Source source) Notifies that the application of all registeredASTProber
s to a newly constructed AST has completed.findLineProbe
(LineLocation lineLocation) Returns theProbe
, if any, associated with source that starts on a specified line; if there are more than one, return the one with the first starting character location.void
getProbesAtLine
(LineLocation line) Returns a collection ofProbe
s whose associated source begins at the givenLineLocation
, an empty list if none.getProbesAtLineNumber
(int lineNumber) Convenience method to get probes according to a int line number.void
newProbeInserted
(Probe probe) Notifies that aProbe
has been newly attached to an AST viaProbeNode.Instrumentable.probe()
.void
probeTaggedAs
(Probe probe, SyntaxTag tag, Object tagValue) Notifies that aSyntaxTag
has been newly added to the set of tags associated with aProbe
viaProbe.tagAs(SyntaxTag, Object)
.void
startASTProbing
(Source source) Notifies that all registeredASTProber
s are about to be applied to a newly constructed AST.
-
Constructor Details
-
LineToProbesMap
public LineToProbesMap()
-
-
Method Details
-
startASTProbing
Description copied from interface:Probe.ProbeListener
Notifies that all registeredASTProber
s are about to be applied to a newly constructed AST.- Specified by:
startASTProbing
in interfaceProbe.ProbeListener
- Parameters:
source
- source code from which the AST was constructed
-
newProbeInserted
Description copied from interface:Probe.ProbeListener
Notifies that aProbe
has been newly attached to an AST viaProbeNode.Instrumentable.probe()
.There can be no more than one
Probe
at a node; this notification will only be delivered the first time probe() is called at a particular AST node. There will also be no notification when the AST to which the Probe is attached is cloned.- Specified by:
newProbeInserted
in interfaceProbe.ProbeListener
-
probeTaggedAs
Description copied from interface:Probe.ProbeListener
Notifies that aSyntaxTag
has been newly added to the set of tags associated with aProbe
viaProbe.tagAs(SyntaxTag, Object)
.The tags at a
Probe
are a set; this notification will only be delivered the first time a particular tag is added at aProbe
.An optional value supplied with tagAs(SyntaxTag, Object) is reported to all listeners, but not stored. As a consequence, the optional value will have no effect at all if the tag had already been added.
- Specified by:
probeTaggedAs
in interfaceProbe.ProbeListener
- Parameters:
probe
- where a tag has been addedtag
- the tag that has been newly added (subsequent additions of the tag are unreported).tagValue
- an optional value associated with the tag for the purposes of reporting.
-
endASTProbing
Description copied from interface:Probe.ProbeListener
Notifies that the application of all registeredASTProber
s to a newly constructed AST has completed.- Specified by:
endASTProbing
in interfaceProbe.ProbeListener
- Parameters:
source
- source code from which the AST was constructed
-
findLineProbe
Returns theProbe
, if any, associated with source that starts on a specified line; if there are more than one, return the one with the first starting character location. -
addProbeToLine
Records creation of a probe whose associated source starts on the given line.If the line already exists in the internal
lineToProbesMap
, this probe will be added to the existing collection. If no line already exists in the internal map, then a new key is added along with a new collection containing the probe.This class requires that each added line/probe pair hasn't been previously added. However, attaching the same probe to a new line location is allowed.
- Parameters:
line
- TheLineLocation
to attach the probe to.probe
- TheProbe
to attach for that line location.
-
getProbesAtLine
Returns a collection ofProbe
s whose associated source begins at the givenLineLocation
, an empty list if none.- Parameters:
line
- The line to check.- Returns:
- A collection of probes at the given line.
-
getProbesAtLineNumber
Convenience method to get probes according to a int line number. Returns a collection ofProbe
s at the given line number, an empty list if none.- Parameters:
lineNumber
- The line number to check.- Returns:
- A collection of probes at the given line.
-
forget
-