org.tromer.jie
Class Opportunity

java.lang.Object
  |
  +--org.tromer.jie.visitor.NullObjectVisitor
        |
        +--org.tromer.jie.Opportunity
Direct Known Subclasses:
Opportunity.EntryExitOpp, Opportunity.SingleActionOpp

public abstract class Opportunity
extends NullObjectVisitor

Base class for all instrumentation opportunity classes. This is a NullObjectVisitor with a bit of added functionality shared by all opportunity classes.


Inner Class Summary
static class Opportunity.EntryExitOpp
          Base class for all opportunities that have two configurable aspects: entry action template and exit action template.
static class Opportunity.SingleActionOpp
          Base class for all opportunities that have one configurable aspect: action template.
 
Field Summary
static java.lang.String classSuffix
          Suffix added to all concrete opportunity classes: "Opp".
 
Constructor Summary
Opportunity()
           
 
Method Summary
 void doneVisiting()
          Must be called from outside when the visit process has been completed.
 java.lang.String getOppName()
          Gets the user-displayable name of this opporunity.
static java.lang.String getOppNameByClass(java.lang.Class c)
          Gets the user-displayable name of an opporunity, using its class.
 int getTransformsCount()
          Get the number of transformations created so far.
protected  void initOpp(java.lang.Object[] actionData)
          Initializes generic aspects of the opportunity.
protected  void log(java.lang.String msg)
          Write a line to the log stream (if one was set using setLog()).
protected  boolean logging()
          Returns true iff logging is enabled.
protected  InstrumTransform newContextlessTransform(java.lang.Object transformContext)
          Similar to newTransform, but does not assign the macro context.
protected  InstrumTransform newTransform(Node node, java.lang.Object transformAndMacroContext)
          Creates a new instance of InstrumTransform, representing an instrumentation transformation carried out by this opportunity.
 void setLog(java.io.OutputStream log)
          Can be used to set (or change) the output stream for the log file.
 
Methods inherited from class org.tromer.jie.visitor.NullObjectVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classSuffix

public static final java.lang.String classSuffix
Suffix added to all concrete opportunity classes: "Opp".
Constructor Detail

Opportunity

public Opportunity()
Method Detail

doneVisiting

public void doneVisiting()
Must be called from outside when the visit process has been completed.

setLog

public void setLog(java.io.OutputStream log)
Can be used to set (or change) the output stream for the log file. If null, logging is not performed.

initOpp

protected void initOpp(java.lang.Object[] actionData)
Initializes generic aspects of the opportunity. This method must be before any other Opportunity method.

Parameters:
actionData - Accepts an array of objects that completely define the action carried out by the instance of the instrumentation opportunity. These objects must implement the getHash() method as outlined in the Java Language Definition. The getHash() results of all the objects are hashed together to produce the first field of the JIID.

getOppName

public java.lang.String getOppName()
Gets the user-displayable name of this opporunity.

getOppNameByClass

public static java.lang.String getOppNameByClass(java.lang.Class c)
Gets the user-displayable name of an opporunity, using its class.

getTransformsCount

public int getTransformsCount()
Get the number of transformations created so far.

newTransform

protected InstrumTransform newTransform(Node node,
                                        java.lang.Object transformAndMacroContext)
Creates a new instance of InstrumTransform, representing an instrumentation transformation carried out by this opportunity. Normally this will be followed by zero or more calls to InstrumTransform.newCode() of the result, and finally a mandatory call to InstrumTransform.doneCoding(). The context parameter are passed as rather than for convenience in the most common use scenario.

newContextlessTransform

protected InstrumTransform newContextlessTransform(java.lang.Object transformContext)
Similar to newTransform, but does not assign the macro context. Call InstrumTransform.setMacroContext later.

log

protected void log(java.lang.String msg)
Write a line to the log stream (if one was set using setLog()).

logging

protected boolean logging()
Returns true iff logging is enabled.