/* This file was generated with JastAdd2 (http://jastadd.org) version jenkins-JastAdd2-432 */
package AST;

/**
 * @production Name : {@link Expr} ::= <span class="component">&lt;name:String&gt;</span>;
 * @ast node
 * @declaredat JavaDemoNames.ast:15
 */
public abstract class Name extends Expr implements Cloneable {
  /**
   * @apilevel internal
   */
  @SuppressWarnings({"unchecked", "cast"})
  public Name clone() throws CloneNotSupportedException {
    Name node = (Name) super.clone();
    node.predKind_visited = -1;
    node.predKind_computed = false;
    node.predKind_value = null;
    node.extra_visited = -1;
    node.kind_visited = -1;
    node.kind_computed = false;
    node.kind_value = null;
    node.in$Circle(false);
    node.is$Final(false);
    return node;
  }
  /**
   * 
   * @ast method
   * 
   */

  public Name() {
    super();
  }
  /**
   * 
     * Initializes the child array to the correct size.
     * Initializes List and Opt nta children.
     * @apilevel internal
     * @ast method
     
   * @ast method
   * 
   */

  public void init$Children() {
  }
  /**
   * 
   * @ast method
   * 
   */

  public Name(String p0) {
    setname(p0);
  }
  /**
   * 
     * @apilevel low-level
     
   * @ast method
   * 
   */

  protected int numChildren() {
    return 0;
  }
  /**
   * 
     * @apilevel internal
     
   * @ast method
   * 
   */

  public boolean mayHaveRewrite() {
    return false;
  }
  /**
   * 
      * @apilevel low-level
      
   * @ast method
   * 
   */

  public void flushCache() {
    super.flushCache();
    if (((Object)tokenString_name) instanceof ASTNode) {
      tokenString_name = null;
    }
    predKind_visited = -1;
    predKind_computed = false;
    predKind_value = null;
    extra_visited = -1;
    kind_visited = -1;
    kind_computed = false;
    kind_value = null;
  }
  /**
   * 
      * @apilevel internal
      
   * @ast method
   * 
   */

  public void flushCollectionCache() {
    super.flushCollectionCache();
  }
  /**
   * 
     * Replaces the lexeme name.
     * @param value The new value for the lexeme name.
     * @apilevel high-level
     
   * @ast method
   * 
   */

  public void setname(String value) {
    tokenString_name = value;
  }
  /**
   * 
     * @apilevel internal
     
   * @ast method
   * 
   */

  

  /**
   * @apilevel internal
   */
  protected String tokenString_name;
  /**
   * 
     * Retrieves the value for the lexeme name.
     * @return The value for the lexeme name.
     * @apilevel high-level
     
   * @ast method
   * 
   */

  public String getname() {
    return tokenString_name != null ? tokenString_name : "";
  }
  /**
   * @apilevel internal
   */
  protected int predKind_visited = -1;
  /**
   * @apilevel internal
   */
  protected boolean predKind_computed = false;
  /**
   * @apilevel internal
   */
  protected Kind predKind_value;
  /**
   * @attribute syn
   * @aspect JavaDemoNames
   * @declaredat JavaDemoNames.jrag:153
   */

  public Kind predKind() {
    
    
        
    if(predKind_computed) {
      return predKind_value;
    }
    ASTNode$State state = state();
    if (predKind_visited == state().boundariesCrossed) {
      throw new RuntimeException("Circular definition of attr: predKind in class: ast.AST.SynDecl");
    }
    predKind_visited = state().boundariesCrossed;
    int num = state.boundariesCrossed;
    boolean isFinal = this.is$Final();
    predKind_value = predKind_compute();
      if(isFinal && num == state().boundariesCrossed){ predKind_computed = true; }
    predKind_visited = -1;
        return predKind_value;
  }
  /**
   * @apilevel internal
   */
  private Kind predKind_compute() {  return Kind.AMBIGUOUS_NAME;  }
  /**
   * @apilevel internal
   */
  protected int extra_visited = -1;
    /**
     * @attribute syn
     * @aspect PrettyPrint
     * @declaredat PrettyPrint.jadd:23
     */
  public String extra() {
    ASTNode$State state = state();
    if (extra_visited == state().boundariesCrossed) {
      throw new RuntimeException("Circular definition of attr: extra in class: ast.AST.SynDecl");
    }
    extra_visited = state().boundariesCrossed;
    try {  return ", name: " + getname();  }
    finally {
      extra_visited = -1;
    }
  }
  /**
   * @attribute inh
   * @aspect JavaDemoNames
   * @declaredat JavaDemoNames.jrag:142
   */

  public Kind kind() {
    
    
        
    if(kind_computed) {
      return kind_value;
    }
    ASTNode$State state = state();
    if (kind_visited == state().boundariesCrossed) {
      throw new RuntimeException("Circular definition of attr: kind in class: ast.AST.InhDecl");
    }
    kind_visited = state().boundariesCrossed;
    int num = state.boundariesCrossed;
    boolean isFinal = this.is$Final();
    kind_value = getParent().Define_Kind_kind(this, null);
      if(isFinal && num == state().boundariesCrossed){ kind_computed = true; }
    kind_visited = -1;
        return kind_value;
  }
  /**
   * @apilevel internal
   */
  protected int kind_visited = -1;
  /**
   * @apilevel internal
   */
  protected boolean kind_computed = false;
  /**
   * @apilevel internal
   */
  protected Kind kind_value;
  /**
   * @apilevel internal
   */
  public ASTNode rewriteTo() {    return super.rewriteTo();
  }}
