abc.tm.weaving.weaver.tmanalysis.stages
Class AbstractAnalysisStage

java.lang.Object
  extended by abc.tm.weaving.weaver.tmanalysis.stages.AbstractAnalysisStage
All Implemented Interfaces:
Stage
Direct Known Subclasses:
CallGraphAbstraction, FlowInsensitiveAnalysis, IntraproceduralAnalysis, QuickCheck

public abstract class AbstractAnalysisStage
extends java.lang.Object
implements Stage

An abstract analysis Stage that provides base functionality such as updating shadows and running assertion checks. Shadows can be updated in two different flavours:

Author:
Eric Bodden

Field Summary
protected  java.lang.String name
          name of this analysis stage; inferred from class name; used for statistical output
protected  Timer shadowUpdateTimer
          timer to time the duration of shadow updating
protected  Timer stageTimer
          timer to time the duration of this stage
protected  java.util.Set validationChecks
          set of validation checks to run after this stage has completed and the shadows have been updated
 
Constructor Summary
protected AbstractAnalysisStage()
          Creates a new analysis stage without any assertion checks.
protected AbstractAnalysisStage(java.lang.Runnable validationCheck)
          Creates a new analysis stage with an attached assertion check.
protected AbstractAnalysisStage(java.util.Set validationChecks)
          Creates a new analysis stage with an attached assertion checks.
 
Method Summary
protected  void appendStatistics()
          Subclasses can overwrite this method to add something to the statistics.
 void apply()
          Applies this stage.
protected  void defaultStatistics()
          Outputs some statistics such as analysis time and number of removed and remaining shadows.
protected  void disableAll(java.util.Set shadowsToDisable)
          Adds the given shadows to the set of shadows to disable.
protected  void disableShadow(java.lang.String uniqueShadowId)
          Adds the given shadow to the set of shadows to disable.
protected abstract  void doAnalysis()
          Performs the actual analysis.
protected  void logToStatistics(java.lang.String label, int value)
          Logs the given label/value pair to the statistics.
protected  void logToStatistics(java.lang.String label, java.lang.Object value)
          Logs the given label/value pair to the statistics.
protected  void retainAll(java.util.Set shadowsToRetain)
          Adds the given shadows to the set of shadows to explicitly retain.
protected  void retainShadow(java.lang.String uniqueShadowId)
          Adds the given shadow to the set of shadows to retain.
protected  void runChecks()
          Runs all attached checks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validationChecks

protected java.util.Set validationChecks
set of validation checks to run after this stage has completed and the shadows have been updated


name

protected final java.lang.String name
name of this analysis stage; inferred from class name; used for statistical output


stageTimer

protected final Timer stageTimer
timer to time the duration of this stage


shadowUpdateTimer

protected final Timer shadowUpdateTimer
timer to time the duration of shadow updating

Constructor Detail

AbstractAnalysisStage

protected AbstractAnalysisStage()
Creates a new analysis stage without any assertion checks.


AbstractAnalysisStage

protected AbstractAnalysisStage(java.lang.Runnable validationCheck)
Creates a new analysis stage with an attached assertion check.

Parameters:
validationCheck - a check in form of a Runnable; it should throw an exception if the check is violated

AbstractAnalysisStage

protected AbstractAnalysisStage(java.util.Set validationChecks)
Creates a new analysis stage with an attached assertion checks.

Parameters:
validationChecks - a set of validation checks
See Also:
AbstractAnalysisStage(Runnable)
Method Detail

apply

public void apply()
Applies this stage.

Specified by:
apply in interface Stage

doAnalysis

protected abstract void doAnalysis()
Performs the actual analysis.


runChecks

protected void runChecks()
Runs all attached checks.


disableAll

protected void disableAll(java.util.Set shadowsToDisable)
Adds the given shadows to the set of shadows to disable.

Parameters:
shadowsToDisable - a set of unique shadow IDs
See Also:
Naming.uniqueShadowID(String, int), Naming.uniqueShadowID(String, String, int)

disableShadow

protected void disableShadow(java.lang.String uniqueShadowId)
Adds the given shadow to the set of shadows to disable.

Parameters:
uniqueShadowId - ID of the shadow to disable
See Also:
Naming.uniqueShadowID(String, int), Naming.uniqueShadowID(String, String, int)

retainAll

protected void retainAll(java.util.Set shadowsToRetain)
Adds the given shadows to the set of shadows to explicitly retain.

Parameters:
shadowsToDisable - a set of unique shadow IDs
See Also:
Naming.uniqueShadowID(String, int), Naming.uniqueShadowID(String, String, int)

retainShadow

protected void retainShadow(java.lang.String uniqueShadowId)
Adds the given shadow to the set of shadows to retain.

Parameters:
uniqueShadowId - ID of the shadow to retain
See Also:
Naming.uniqueShadowID(String, int), Naming.uniqueShadowID(String, String, int)

logToStatistics

protected void logToStatistics(java.lang.String label,
                               java.lang.Object value)
Logs the given label/value pair to the statistics.

Parameters:
label - any label
value - any object

logToStatistics

protected void logToStatistics(java.lang.String label,
                               int value)
Logs the given label/value pair to the statistics.

Parameters:
label - any label
value - any int

appendStatistics

protected void appendStatistics()
Subclasses can overwrite this method to add something to the statistics. Use logToStatistics(String, Object) to do so.


defaultStatistics

protected void defaultStatistics()
Outputs some statistics such as analysis time and number of removed and remaining shadows.