
package AST;

public abstract class Expr extends ASTNode<ASTNode> implements Cloneable {

  @SuppressWarnings({"unchecked", "cast"})
  public Expr clone() throws CloneNotSupportedException {
    Expr node = (Expr) super.clone();
    node.type_visited = -1;
    node.type_computed = false;
    node.type_value = null;
    node.qualifiedLookupType_String_visited = null;
    node.qualifiedLookupType_String_values = null;
    node.qualifiedHasPackage_String_visited = null;
    node.qualifiedHasPackage_String_values = null;
    node.unknownType_visited = -1;
    node.unknownType_computed = false;
    node.unknownType_value = null;
    node.lookupVariable_String_visited = null;
    node.lookupVariable_String_values = null;
    node.lookupType_String_visited = null;
    node.lookupType_String_values = null;
    node.lookupCanonical_String_String_visited = null;
    node.lookupCanonical_String_String_values = null;
    node.hasPackage_String_visited = null;
    node.hasPackage_String_values = null;
    return node;
  }

  public Expr() {
    super();
  }

  public void init$Children() {
  }

  protected int numChildren() {
    return 0;
  }

  public boolean mayHaveRewrite() {
    return false;
  }

  public void flushCache() {
    super.flushCache();
    type_visited = -1;
    type_computed = false;
    type_value = null;
    qualifiedLookupType_String_visited = null;
    qualifiedLookupType_String_values = null;
    qualifiedHasPackage_String_visited = null;
    qualifiedHasPackage_String_values = null;
    unknownType_visited = -1;
    unknownType_computed = false;
    unknownType_value = null;
    lookupVariable_String_visited = null;
    lookupVariable_String_values = null;
    lookupType_String_visited = null;
    lookupType_String_values = null;
    lookupCanonical_String_String_visited = null;
    lookupCanonical_String_String_values = null;
    hasPackage_String_visited = null;
    hasPackage_String_values = null;
  }

  public void flushCollectionCache() {
    super.flushCollectionCache();
  }

  protected int type_visited = -1;
  protected boolean type_computed = false;
  protected ClassDecl type_value;

  public ClassDecl type() {
    if(type_computed) {
      return type_value;
    }
    ASTNode$State state = state();
    if (type_visited == state.CIRCLE_INDEX) {
      throw new RuntimeException("Circular definition of attr: type in class: ast.AST.SynDecl");
    }     
    type_visited = state.CIRCLE_INDEX; 
    boolean cycleEndStore = state.CYCLE_END;
    type_value = type_compute();
    if (!state.IN_CIRCLE || state.IN_CIRCLE && (!state.CYCLE_END || state.LAST_CYCLE) ) {
      type_computed = true; 
      Tracer.traceCached(this, "Expr.type", "", "" + type_value);
    } else Tracer.traceCacheAbort(this, "Expr.type", "", "" + type_value);
    state.CYCLE_END = cycleEndStore || state.CYCLE_END;
    type_visited = -1;
    return type_value;
  }

  private ClassDecl type_compute() {  return unknownType();  }

  protected java.util.Map qualifiedLookupType_String_visited;
  protected java.util.Map qualifiedLookupType_String_values;

  public ClassDecl qualifiedLookupType(String typeName) {
    Object _parameters = typeName;
    if(qualifiedLookupType_String_visited == null) qualifiedLookupType_String_visited = new java.util.HashMap(4);
    if(qualifiedLookupType_String_values == null) qualifiedLookupType_String_values = new java.util.HashMap(4);
    if(qualifiedLookupType_String_values.containsKey(_parameters)) {
      return (ClassDecl)qualifiedLookupType_String_values.get(_parameters); 
    }
    ASTNode$State state = state();
    if (Integer.valueOf(state.CIRCLE_INDEX).equals(qualifiedLookupType_String_visited.get(_parameters))) {
      throw new RuntimeException("Circular definition of attr: qualifiedLookupType in class: ast.AST.SynDecl");
    }           
    qualifiedLookupType_String_visited.put(_parameters, Integer.valueOf(state.CIRCLE_INDEX));
    boolean cycleEndStore = state.CYCLE_END;
    ClassDecl qualifiedLookupType_String_value = qualifiedLookupType_compute(typeName);
    if (!state.IN_CIRCLE || state.IN_CIRCLE && (!state.CYCLE_END || state.LAST_CYCLE) ) {
      qualifiedLookupType_String_values.put(_parameters, qualifiedLookupType_String_value);
      Tracer.traceCached(this, "Expr.qualifiedLookupType", typeName, "" + qualifiedLookupType_String_value);
    } else Tracer.traceCacheAbort(this, "Expr.qualifiedLookupType", typeName, "" + qualifiedLookupType_String_value);
    state.CYCLE_END = cycleEndStore || state.CYCLE_END;
    qualifiedLookupType_String_visited.remove(_parameters);
    return qualifiedLookupType_String_value;
  }

  private ClassDecl qualifiedLookupType_compute(String typeName) {  return type().memberClass(typeName);  }

  protected java.util.Map qualifiedHasPackage_String_visited;
  protected java.util.Map qualifiedHasPackage_String_values;

  public boolean qualifiedHasPackage(String name) {
    Object _parameters = name;
    if(qualifiedHasPackage_String_visited == null) qualifiedHasPackage_String_visited = new java.util.HashMap(4);
    if(qualifiedHasPackage_String_values == null) qualifiedHasPackage_String_values = new java.util.HashMap(4);
    if(qualifiedHasPackage_String_values.containsKey(_parameters)) {
      return ((Boolean)qualifiedHasPackage_String_values.get(_parameters)).booleanValue(); 
    }
    ASTNode$State state = state();
    if (Integer.valueOf(state.CIRCLE_INDEX).equals(qualifiedHasPackage_String_visited.get(_parameters))) {
      throw new RuntimeException("Circular definition of attr: qualifiedHasPackage in class: ast.AST.SynDecl");
    }
    qualifiedHasPackage_String_visited.put(_parameters, Integer.valueOf(state.CIRCLE_INDEX));
    boolean cycleEndStore = state.CYCLE_END;
    boolean qualifiedHasPackage_String_value = qualifiedHasPackage_compute(name);
    if (!state.IN_CIRCLE || state.IN_CIRCLE && (!state.CYCLE_END || state.LAST_CYCLE) ) {
      qualifiedHasPackage_String_values.put(_parameters, Boolean.valueOf(qualifiedHasPackage_String_value)); 
      Tracer.traceCached(this, "Expr.qualifiedHasPackage", name, "" + qualifiedHasPackage_String_value);
    } else Tracer.traceCacheAbort(this, "Expr.qualifiedHasPackage", name, "" + qualifiedHasPackage_String_value);
    state.CYCLE_END = cycleEndStore || state.CYCLE_END;
    qualifiedHasPackage_String_visited.remove(_parameters);
    return qualifiedHasPackage_String_value;
  }

  private boolean qualifiedHasPackage_compute(String name) {  return false;  }

  public ClassDecl unknownType() {
    if(unknownType_computed) {
      return unknownType_value;
    }
    ASTNode$State state = state();
    if (unknownType_visited == state.CIRCLE_INDEX) {
      throw new RuntimeException("Circular definition of attr: unknownType in class: ast.AST.InhDecl");
    }     
    unknownType_visited = state.CIRCLE_INDEX; 
    boolean cycleEndStore = state.CYCLE_END;
    unknownType_value = getParent().Define_ClassDecl_unknownType(this, null);
    if (!state.IN_CIRCLE || state.IN_CIRCLE && (!state.CYCLE_END || state.LAST_CYCLE) ) {
      unknownType_computed = true; 
      Tracer.traceCached(this, "Expr.unknownType", "", "" + unknownType_value);
    } else Tracer.traceCacheAbort(this, "Expr.unknownType", "", "" + unknownType_value);
    state.CYCLE_END = cycleEndStore || state.CYCLE_END;
    unknownType_visited = -1;
    return unknownType_value;
  }

  protected int unknownType_visited = -1;
  protected boolean unknownType_computed = false;
  protected ClassDecl unknownType_value;

  public Variable lookupVariable(String name) {
    Object _parameters = name;
    if(lookupVariable_String_visited == null) lookupVariable_String_visited = new java.util.HashMap(4);
    if(lookupVariable_String_values == null) lookupVariable_String_values = new java.util.HashMap(4);
    if(lookupVariable_String_values.containsKey(_parameters)) {
      return (Variable)lookupVariable_String_values.get(_parameters); 
    }
    ASTNode$State state = state();
    if (Integer.valueOf(state.CIRCLE_INDEX).equals(lookupVariable_String_visited.get(_parameters))) {
      throw new RuntimeException("Circular definition of attr: lookupVariable in class: ast.AST.InhDecl");
    }            
    lookupVariable_String_visited.put(_parameters, Integer.valueOf(state.CIRCLE_INDEX));
    boolean cycleEndStore = state.CYCLE_END;
    Variable lookupVariable_String_value = getParent().Define_Variable_lookupVariable(this, null, name);
    if (!state.IN_CIRCLE || state.IN_CIRCLE && (!state.CYCLE_END || state.LAST_CYCLE) ) {
      lookupVariable_String_values.put(_parameters, lookupVariable_String_value); 
      Tracer.traceCached(this, "Expr.lookupVariable", name, "" + lookupVariable_String_value);
    } else Tracer.traceCacheAbort(this, "Expr.lookupVariable", name, "" + lookupVariable_String_value);
    state.CYCLE_END = cycleEndStore || state.CYCLE_END;
    lookupVariable_String_visited.remove(_parameters);
    return lookupVariable_String_value;
  }

  protected java.util.Map lookupVariable_String_visited;
  protected java.util.Map lookupVariable_String_values;

  public ClassDecl lookupType(String name) {
    Object _parameters = name;
    if(lookupType_String_visited == null) lookupType_String_visited = new java.util.HashMap(4);
    if(lookupType_String_values == null) lookupType_String_values = new java.util.HashMap(4);
    if(lookupType_String_values.containsKey(_parameters)) {
      return (ClassDecl)lookupType_String_values.get(_parameters); 
    }
    ASTNode$State state = state();
    if (Integer.valueOf(state.CIRCLE_INDEX).equals(lookupType_String_visited.get(_parameters))) {
      throw new RuntimeException("Circular definition of attr: lookupType in class: ast.AST.InhDecl");
    }            
    lookupType_String_visited.put(_parameters, Integer.valueOf(state.CIRCLE_INDEX));     
    boolean cycleEndStore = state.CYCLE_END;
    ClassDecl lookupType_String_value = getParent().Define_ClassDecl_lookupType(this, null, name);
    if (!state.IN_CIRCLE || state.IN_CIRCLE && (!state.CYCLE_END || state.LAST_CYCLE) ) {
      lookupType_String_values.put(_parameters, lookupType_String_value); 
      Tracer.traceCached(this, "Expr.lookupType", name, "" + lookupType_String_value);
    } else Tracer.traceCacheAbort(this, "Expr.lookupType", name, "" + lookupType_String_value);
    state.CYCLE_END = cycleEndStore || state.CYCLE_END;
    lookupType_String_visited.remove(_parameters);
    return lookupType_String_value;
  }

  protected java.util.Map lookupType_String_visited;
  protected java.util.Map lookupType_String_values;

  public ClassDecl lookupCanonical(String pack, String type) {
    java.util.List _parameters = new java.util.ArrayList(2);
    _parameters.add(pack);
    _parameters.add(type);
    if(lookupCanonical_String_String_visited == null) lookupCanonical_String_String_visited = new java.util.HashMap(4);
    if(lookupCanonical_String_String_values == null) lookupCanonical_String_String_values = new java.util.HashMap(4);
    if(lookupCanonical_String_String_values.containsKey(_parameters)) {
      return (ClassDecl)lookupCanonical_String_String_values.get(_parameters); 
    }
    ASTNode$State state = state();
    if (Integer.valueOf(state.CIRCLE_INDEX).equals(lookupCanonical_String_String_visited.get(_parameters))) {
      throw new RuntimeException("Circular definition of attr: lookupCanonical in class: ast.AST.InhDecl");
    }            
    lookupCanonical_String_String_visited.put(_parameters, Integer.valueOf(state.CIRCLE_INDEX));      
    boolean cycleEndStore = state.CYCLE_END;
    ClassDecl lookupCanonical_String_String_value = getParent().Define_ClassDecl_lookupCanonical(this, null, pack, type);
    if (!state.IN_CIRCLE || state.IN_CIRCLE && (!state.CYCLE_END || state.LAST_CYCLE) ) {
      lookupCanonical_String_String_values.put(_parameters, lookupCanonical_String_String_value); 
      Tracer.traceCached(this, "Expr.lookupCanonical", "" + _parameters, "" + lookupCanonical_String_String_value);
    } else Tracer.traceCacheAbort(this, "Expr.lookupCanonical", "" + _parameters, "" + lookupCanonical_String_String_value);
    state.CYCLE_END = cycleEndStore || state.CYCLE_END;
    lookupCanonical_String_String_visited.remove(_parameters);
    return lookupCanonical_String_String_value;
  }

  protected java.util.Map lookupCanonical_String_String_visited;
  protected java.util.Map lookupCanonical_String_String_values;

  public boolean hasPackage(String name) {
    Object _parameters = name;
    if(hasPackage_String_visited == null) hasPackage_String_visited = new java.util.HashMap(4);
    if(hasPackage_String_values == null) hasPackage_String_values = new java.util.HashMap(4);
    if(hasPackage_String_values.containsKey(_parameters)) {
      return ((Boolean)hasPackage_String_values.get(_parameters)).booleanValue(); 
    }
    ASTNode$State state = state();
    if (Integer.valueOf(state.CIRCLE_INDEX).equals(hasPackage_String_visited.get(_parameters))) {
      throw new RuntimeException("Circular definition of attr: hasPackage in class: ast.AST.InhDecl");
    }           
    hasPackage_String_visited.put(_parameters, Integer.valueOf(state.CIRCLE_INDEX));     
    boolean cycleEndStore = state.CYCLE_END;
    boolean hasPackage_String_value = getParent().Define_boolean_hasPackage(this, null, name);
    if (!state.IN_CIRCLE || state.IN_CIRCLE && (!state.CYCLE_END || state.LAST_CYCLE) ) {
      hasPackage_String_values.put(_parameters, Boolean.valueOf(hasPackage_String_value)); 
      Tracer.traceCached(this, "Expr.hasPackage", name, "" + hasPackage_String_value);
    } else Tracer.traceCacheAbort(this, "Expr.hasPackage", name, "" + hasPackage_String_value);
    state.CYCLE_END = cycleEndStore || state.CYCLE_END;
    hasPackage_String_visited.remove(_parameters);
    return hasPackage_String_value;
  }

  protected java.util.Map hasPackage_String_visited;
  protected java.util.Map hasPackage_String_values;

  public ASTNode rewriteTo() {    return super.rewriteTo(); }
}
