|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.tromer.jie.InstrumTransform
This class represents an instrumentation transformation, which is a single application of an instrumentation rule. The transformation may be composed of several code sections, each represented by an InstrumCode instance.
To add pieces of code to this instrumentation, use newCode().
A transformation uses two VisitContext
objects:
setMacroContext
, which is used for
expanding macros (including JIID).
Inner Class Summary | |
static interface |
InstrumTransform.MacroExpansionException
Thrown when InstrumTransform encounters an invalid
action template macro. |
Field Summary | |
java.lang.String |
macroPrefix
|
java.lang.String |
macroSuffix
|
Constructor Summary | |
InstrumTransform(VisitContext transformContext,
java.lang.String id,
long actionHash)
Creates a new InstrumTransform instance for a transformation that occurs in the neighbourhood of the specified node and in the specified context. |
Method Summary | |
protected void |
applyMacroContext()
|
java.lang.String |
createHelperMethod(java.lang.String type,
java.lang.String args,
java.lang.String code)
Add a uniquely named helper method to the class in which this transformation is carried out. |
java.lang.String |
createUniqueIdentifier()
Create a uniquely named identifier. |
void |
doneCoding()
Declares the code creation stage to be complete. |
static java.lang.String |
encodeLong(long num)
Performs a JIID-style base32 encoding of a 'long' value to 13 alphanumeric characters. |
protected java.lang.String |
expandMacro(java.lang.String macro)
Expands a single macro, which must be stripped of macro prefix and suffix. |
protected java.lang.String |
expandMacrosIn(java.lang.String action)
Expands all macros in the specified string and returns the expanded version. |
java.lang.String |
getJiid()
Returns the JIID of this transform. |
java.util.Vector |
getPieces()
|
java.lang.String |
getTransformId()
|
(package private) static long |
hashTogether(long x,
int y)
Hashes two long values together in a deterministic fashion. |
void |
instrumentAfterExpressionExec(Node expr,
java.lang.String text,
java.lang.String exprType)
|
void |
instrumentAfterStatement(Node statement,
java.lang.String text)
|
void |
instrumentBeforeBooleanExpressionExec(Node expr,
java.lang.String text)
Specific to boolean expressions, but does not have the "possibly undefined variables" problems of instrumentBeforeExpressionExec . |
void |
instrumentBeforeExpressionExec(Node expr,
java.lang.String text,
java.lang.String exprType)
May cause problems with "possibly undefined variables" in case the expression uses the assignment operator. |
void |
instrumentBeforeStatement(Node statement,
java.lang.String text)
|
boolean |
isKilled()
True iff kill() was called. |
void |
kill()
Remove this transformation. |
InstrumCode |
newCode(java.lang.String text)
Adds a piece of code to this transformation. |
void |
setMacroContext(VisitContext macroContext,
java.awt.Point macroPosition)
Sets the context for macro expansion. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public final java.lang.String macroPrefix
public final java.lang.String macroSuffix
Constructor Detail |
public InstrumTransform(VisitContext transformContext, java.lang.String id, long actionHash)
transformContext
- The context where the transformation occurs.
This does not affect macro expansion.actionHash
- A hash of the action and opportunity data
of the rule.Method Detail |
public java.util.Vector getPieces()
public java.lang.String getTransformId()
public java.lang.String createUniqueIdentifier()
public InstrumCode newCode(java.lang.String text)
public void doneCoding()
public void kill()
doneCoding()
.public boolean isKilled()
kill()
was called.public java.lang.String getJiid()
doneCoding
and applyMacroContext
are called.public java.lang.String createHelperMethod(java.lang.String type, java.lang.String args, java.lang.String code)
InstrumTransform
instance holds a pool of helper
method, and if this method is requested again then the name of the
existing method will be returned rather than creating a duplicate.context.classNodeBody must be non-null, meaning we're in an actual class.
public void instrumentBeforeExpressionExec(Node expr, java.lang.String text, java.lang.String exprType)
public void instrumentBeforeBooleanExpressionExec(Node expr, java.lang.String text)
instrumentBeforeExpressionExec
.public void instrumentAfterExpressionExec(Node expr, java.lang.String text, java.lang.String exprType)
public void instrumentBeforeStatement(Node statement, java.lang.String text)
public void instrumentAfterStatement(Node statement, java.lang.String text)
public void setMacroContext(VisitContext macroContext, java.awt.Point macroPosition)
doneCoding()
.protected void applyMacroContext()
protected java.lang.String expandMacrosIn(java.lang.String action)
protected java.lang.String expandMacro(java.lang.String macro)
public static java.lang.String encodeLong(long num)
static long hashTogether(long x, int y)
long
values together in a deterministic fashion.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |