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

/**
 * @production MemberClassDecl : {@link BodyDecl} ::= <span class="component">{@link ClassDecl}</span>;
 * @ast node
 * @declaredat JavaDemoNames.ast:7
 */
public class MemberClassDecl extends BodyDecl implements Cloneable {
  /**
   * @apilevel internal
   */
  @SuppressWarnings({"unchecked", "cast"})
  public MemberClassDecl clone() throws CloneNotSupportedException {
    MemberClassDecl node = (MemberClassDecl) super.clone();
    node.isMemberClass_String_visited = null;
    node.isMemberClass_String_values = null;
    node.in$Circle(false);
    node.is$Final(false);
    return node;
  }
  /**
   * @apilevel internal
   */
  @SuppressWarnings({"unchecked", "cast"})
  public MemberClassDecl copy() {
    try {
      MemberClassDecl node = (MemberClassDecl) clone();
      node.parent = null;
      if(children != null) {
        node.children = (ASTNode[]) children.clone();
      }
      return node;
    } catch (CloneNotSupportedException e) {
      throw new Error("Error: clone not supported for " + getClass().getName());
    }
  }
  /**
   * Create a deep copy of the AST subtree at this node.
   * The copy is dangling, i.e. has no parent.
   * @return dangling copy of the subtree at this node
   * @apilevel low-level
   */
  @SuppressWarnings({"unchecked", "cast"})
  public MemberClassDecl fullCopy() {
    MemberClassDecl tree = (MemberClassDecl) copy();
    if (children != null) {
      for (int i = 0; i < children.length; ++i) {
        ASTNode child = (ASTNode) children[i];
        if(child != null) {
          child = child.fullCopy();
          tree.setChild(child, i);
        }
      }
    }
    return tree;
  }
  /**
   * 
   * @ast method
   * 
   */

  public MemberClassDecl() {
    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() {
    children = new ASTNode[1];
  }
  /**
   * 
   * @ast method
   * 
   */

  public MemberClassDecl(ClassDecl p0) {
    setChild(p0, 0);
  }
  /**
   * 
     * @apilevel low-level
     
   * @ast method
   * 
   */

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

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

  public void flushCache() {
    super.flushCache();
        isMemberClass_String_visited = null;
    isMemberClass_String_values = null;
  }
  /**
   * 
      * @apilevel internal
      
   * @ast method
   * 
   */

  public void flushCollectionCache() {
    super.flushCollectionCache();
      }
  /**
   * 
     * Replaces the ClassDecl child.
     * @param node The new node to replace the ClassDecl child.
     * @apilevel high-level
     
   * @ast method
   * 
   */

  public void setClassDecl(ClassDecl node) {
    setChild(node, 0);
  }
  /**
   * 
     * Retrieves the ClassDecl child.
     * @return The current node used as the ClassDecl child.
     * @apilevel high-level
     
   * @ast method
   * 
   */

  public ClassDecl getClassDecl() {
    return (ClassDecl) getChild(0);
  }
  /**
   * 
     * Retrieves the ClassDecl child.
     * <p><em>This method does not invoke AST transformations.</em></p>
     * @return The current node used as the ClassDecl child.
     * @apilevel low-level
     
   * @ast method
   * 
   */

  public ClassDecl getClassDeclNoTransform() {
    return (ClassDecl) getChildNoTransform(0);
  }
  /**
   * @apilevel internal
   */
  protected java.util.Map isMemberClass_String_visited;
  protected java.util.Map isMemberClass_String_values;
  /**
   * @attribute syn
   * @aspect JavaDemoNames
   * @declaredat JavaDemoNames.jrag:114
   */

  public boolean isMemberClass(String name) {
    Object _parameters = name;
    if(isMemberClass_String_visited == null) isMemberClass_String_visited = new java.util.HashMap(4);
    if(isMemberClass_String_values == null) isMemberClass_String_values = new java.util.HashMap(4);
    

    
if(isMemberClass_String_values.containsKey(_parameters)) {
  return ((Boolean)isMemberClass_String_values.get(_parameters)).booleanValue(); 
}

    ASTNode$State state = state();
    if (Integer.valueOf(state().boundariesCrossed).equals(isMemberClass_String_visited.get(_parameters))) {
      throw new RuntimeException("Circular definition of attr: isMemberClass in class: ast.AST.SynDecl");
    }
                
    isMemberClass_String_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed));
          
    int num = state.boundariesCrossed;
    boolean isFinal = this.is$Final();
    boolean isMemberClass_String_value = isMemberClass_compute(name);
      if(isFinal && num == state().boundariesCrossed){ isMemberClass_String_values.put(_parameters, Boolean.valueOf(isMemberClass_String_value)); }
    isMemberClass_String_visited.remove(_parameters);
        return isMemberClass_String_value;
  }
  /**
   * @apilevel internal
   */
  private boolean isMemberClass_compute(String name) {  return getClassDecl().getname().equals(name);  }
  /**
   * @apilevel internal
   */
  public ASTNode rewriteTo() {    return super.rewriteTo();
  }}
