public class LineToProbesMap extends java.lang.Object implements Probe.ProbeListener
LineLocation (a line number in a specific piece of Source code) to
a collection of Probes whose associated SourceSection starts on that line.| Constructor and Description |
|---|
LineToProbesMap() |
| Modifier and Type | Method and Description |
|---|---|
protected 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 registered
ASTProbers to a newly constructed
AST has completed. |
Probe |
findLineProbe(LineLocation lineLocation)
Returns the
Probe, 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 |
forget(Source source) |
java.util.Collection<Probe> |
getProbesAtLine(LineLocation line)
Returns a collection of
Probes whose associated source begins at the given
LineLocation, an empty list if none. |
java.util.Collection<Probe> |
getProbesAtLineNumber(int lineNumber)
Convenience method to get probes according to a int line number.
|
void |
newProbeInserted(Probe probe)
Notifies that a
Probe has been newly attached to an AST via
ProbeNode.Instrumentable.probe(). |
void |
probeTaggedAs(Probe probe,
SyntaxTag tag,
java.lang.Object tagValue)
Notifies that a
SyntaxTag has been newly added to the set of tags associated with
a Probe via Probe.tagAs(SyntaxTag, Object). |
void |
startASTProbing(Source source)
Notifies that all registered
ASTProbers are about to be applied to a newly
constructed AST. |
public void startASTProbing(Source source)
Probe.ProbeListenerASTProbers are about to be applied to a newly
constructed AST.startASTProbing in interface Probe.ProbeListenersource - source code from which the AST was constructedpublic void newProbeInserted(Probe probe)
Probe.ProbeListenerProbe has been newly attached to an AST via
ProbeNode.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.
newProbeInserted in interface Probe.ProbeListenerpublic void probeTaggedAs(Probe probe, SyntaxTag tag, java.lang.Object tagValue)
Probe.ProbeListenerSyntaxTag has been newly added to the set of tags associated with
a Probe via Probe.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
a Probe.
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.
probeTaggedAs in interface Probe.ProbeListenerprobe - 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.public void endASTProbing(Source source)
Probe.ProbeListenerASTProbers to a newly constructed
AST has completed.endASTProbing in interface Probe.ProbeListenersource - source code from which the AST was constructedpublic Probe findLineProbe(LineLocation lineLocation)
Probe, 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.protected void addProbeToLine(LineLocation line, Probe probe)
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.
line - The LineLocation to attach the probe to.probe - The Probe to attach for that line location.public java.util.Collection<Probe> getProbesAtLine(LineLocation line)
Probes whose associated source begins at the given
LineLocation, an empty list if none.line - The line to check.public java.util.Collection<Probe> getProbesAtLineNumber(int lineNumber)
Probes at the given line number, an empty list if none.lineNumber - The line number to check.public void forget(Source source)