package aspectEditor.aspectEditorUtils;
import java.util.jar.JarFile;
import java.util.*;
import java.io.*;
import edu.neu.ccs.demeter.aplib.*;
import edu.neu.ccs.demeter.*;
public class StrategyReference extends Strategy {
  protected Ident ident;
  public Ident get_ident() { return ident; }
  public void set_ident(Ident new_ident) { ident = new_ident; }
  public StrategyReference() { super(); }
  public StrategyReference(Ident ident) {
    super();
    set_ident(ident);
  }
  public static StrategyReference parse(java.io.Reader in) throws ParseException { return new Parser(in)._StrategyReference(); }
  public static StrategyReference parse(java.io.InputStream in) throws ParseException { return new Parser(in)._StrategyReference(); }
  public static StrategyReference parse(String s) {
    try { return parse(new java.io.StringReader(s)); }
    catch (ParseException e) {
      throw new RuntimeException(e.toString());
    }
  }
 Map env; Strategy strategy; 
  Strategy deref() {
    if (strategy == null) {
      strategy = (Strategy) env.get(ident.toString());
      if (strategy == null)
	throw new RuntimeException("No such strategy: " + ident);
    }
    return strategy;
  }
  public boolean isSimpleStrategy() {
    return deref().isSimpleStrategy();
  }
  public SimpleStrategyI toSimpleStrategy() {
    return deref().toSimpleStrategy();
  }
  public boolean isStrategyCombination() {
    return deref().isStrategyCombination();
  }
  public StrategyCombinationI toStrategyCombination() {
    return deref().toStrategyCombination();
  }
  public Set getSourceNames() {
    return deref().getSourceNames();
  }
  public Set getTargetNames() {
    return deref().getTargetNames();
  }
  public String toString() {
    StringWriter w = new StringWriter();
    PrintWriter pw = new PrintWriter(w);
    universal_trv0(new PrintVisitor(pw));
    pw.flush();
    return w.toString();
  }
  void universal_trv0_bef(UniversalVisitor _v_) {
    super.universal_trv0_bef(_v_);
    ((UniversalVisitor) _v_).before(this);
  }

  void universal_trv0_aft(UniversalVisitor _v_) {
    ((UniversalVisitor) _v_).after(this);
    super.universal_trv0_aft(_v_);
  }

  void universal_trv0(UniversalVisitor _v_) {
    universal_trv0_bef(_v_);
    ((UniversalVisitor) _v_).before_ident(this, ident);
    ((UniversalVisitor) _v_).after_ident(this, ident);
    super.universal_trv0(_v_);
    universal_trv0_aft(_v_);
  }

  void __trav_attachEnv_Strategy_trv_bef(__V_Strategy_attachEnv __v0) {
    super.__trav_attachEnv_Strategy_trv_bef(__v0);
    ((__V_Strategy_attachEnv) __v0).before(this);
  }

  void __trav_attachEnv_Strategy_trv_aft(__V_Strategy_attachEnv __v0) {
    super.__trav_attachEnv_Strategy_trv_aft(__v0);
  }

  void __trav_attachEnv_Strategy_trv(__V_Strategy_attachEnv __v0) {
    __trav_attachEnv_Strategy_trv_bef(__v0);
    __trav_attachEnv_Strategy_trv_aft(__v0);
  }

  void __trav_toGraph_PathDirective_trv(__V_PathDirective_toGraph __v0) {  }

}
