harpoon.Tools.PatMat
Class Spec.RuleExp

java.lang.Object
  extended by harpoon.Tools.PatMat.Spec.Rule
      extended by harpoon.Tools.PatMat.Spec.RuleExp
Enclosing class:
Spec

public static class Spec.RuleExp
extends Spec.Rule

Extension of Spec.Rule that also contains a Spec.Exp to match Tree expressions and the identifier for the result that this produces. Spec.RuleExps match (sub)expressions in the code, which is why it is necessary to associate a result_id: expression matching is context sensitive, depending on what the outerlying expression or statement is expecting the nested expression to return.


Field Summary
 Spec.Exp exp
          Expression this matches.
 String result_id
          Identifier for return value of expression that this matches.
 
Fields inherited from class harpoon.Tools.PatMat.Spec.Rule
action_str, details
 
Constructor Summary
Spec.RuleExp(Spec.Exp exp, String result_id, Spec.DetailList details, String action_str)
          Constructs a new Spec.RuleExp.
 
Method Summary
 void accept(Spec.RuleVisitor v)
          Applies v's visit method to this.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

exp

public final Spec.Exp exp
Expression this matches.


result_id

public final String result_id
Identifier for return value of expression that this matches.

Constructor Detail

Spec.RuleExp

public Spec.RuleExp(Spec.Exp exp,
                    String result_id,
                    Spec.DetailList details,
                    String action_str)
Constructs a new Spec.RuleExp.
requires: action_str is a series of valid Java code statements.
effects: constructs a new Spec.RuleExp object with associated Spec.Exp, result_id, Spec.DetailList, and action to perform if this fires.

Parameters:
exp - Spec.Exp associated with this.
result_id - Tag identifying type of result that this produces.
details - List of extra details associated with this (speed-cost, size-cost, predicates, etc.).
action_str - Series of Java code statements that represent the action to perform if this fires.
Method Detail

accept

public void accept(Spec.RuleVisitor v)
Description copied from class: Spec.Rule
Applies v's visit method to this. This is effectively a gludge to emulate multiple dispatch. Must be reimplemented by all subclasses of Spec.Rule.
effects: Calls v.visit(this).

Specified by:
accept in class Spec.Rule
See Also:
"Design Patterns pgs. 331-344"

toString

public String toString()
Overrides:
toString in class Spec.Rule