001    /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.3 */
002    package AST;
003    
004    import java.util.Collection;
005    import java.util.ArrayList;
006    import java.util.HashSet;
007    /**
008     * @ast node
009     * @declaredat /home/csz-naf/examples/PicoJava/spec/picojava.ast:6
010     * @production Decl : {@link BlockStmt} ::= <span class="component">&lt;Name:String&gt;</span>;
011    
012     */
013    public abstract class Decl extends BlockStmt implements Cloneable {
014      /**
015       * @apilevel internal
016       */
017      public Decl clone() throws CloneNotSupportedException {
018        Decl node = (Decl) super.clone();
019        node.declarationOf_String_visited = null;
020        node.isUnknown_visited = -1;
021        node.booleanType_visited = -1;
022        node.in$Circle(false);
023        node.is$Final(false);
024        return node;
025      }
026      /**
027       */
028      public Decl() {
029        super();
030      }
031      /**
032       * Initializes the child array to the correct size.
033       * Initializes List and Opt nta children.
034       * @apilevel internal
035       * @ast method
036       */
037      public void init$Children() {
038      }
039      /**
040       */
041      public Decl(String p0) {
042        setName(p0);
043      }
044      /**
045       * @apilevel low-level
046       */
047      protected int numChildren() {
048        return 0;
049      }
050      /**
051       * @apilevel internal
052       */
053      public boolean mayHaveRewrite() {
054        return false;
055      }
056      /**
057       * @apilevel low-level
058       */
059      public void flushCache() {
060        super.flushCache();
061        declarationOf_String_visited = null;
062        isUnknown_visited = -1;
063        booleanType_visited = -1;
064      }
065      /**
066       * @apilevel internal
067       */
068      public void flushCollectionCache() {
069        super.flushCollectionCache();
070      }
071      /**
072       * Replaces the lexeme Name.
073       * @param value The new value for the lexeme Name.
074       * @apilevel high-level
075       */
076      public void setName(String value) {
077        tokenString_Name = value;
078      }
079      /**
080       * @apilevel internal
081       */
082      protected String tokenString_Name;
083      /**
084       * Retrieves the value for the lexeme Name.
085       * @return The value for the lexeme Name.
086       * @apilevel high-level
087       */
088      public String getName() {
089        return tokenString_Name != null ? tokenString_Name : "";
090      }
091      /**
092       * @attribute syn
093       * @aspect TypeAnalysis
094       * @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:9
095       */
096      public abstract TypeDecl type();
097      /**
098       * @apilevel internal
099       */
100      protected java.util.Map declarationOf_String_visited;
101      /**
102       * @attribute syn
103       * @aspect NameResolution
104       * @declaredat /home/csz-naf/examples/PicoJava/spec/NameResolution.jrag:100
105       */
106      public Decl declarationOf(String name) {
107        Object _parameters = name;
108        if(declarationOf_String_visited == null) declarationOf_String_visited = new java.util.HashMap(4);
109        ASTNode$State state = state();
110        if (Integer.valueOf(state().boundariesCrossed).equals(declarationOf_String_visited.get(_parameters))) {
111          throw new RuntimeException("Circular definition of attr: declarationOf in class: org.jastadd.ast.AST.SynDecl");
112        }
113        declarationOf_String_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed));
114        try {
115            if (getName().equals(name)) return this;
116            return null;
117          }
118        finally {
119          declarationOf_String_visited.remove(_parameters);
120        }
121      }
122      /**
123       * @apilevel internal
124       */
125      protected int isUnknown_visited = -1;
126      /**
127       * @attribute syn
128       * @aspect NullObjects
129       * @declaredat /home/csz-naf/examples/PicoJava/spec/NullObjects.jrag:5
130       */
131      public boolean isUnknown() {
132        ASTNode$State state = state();
133        if (isUnknown_visited == state().boundariesCrossed) {
134          throw new RuntimeException("Circular definition of attr: isUnknown in class: org.jastadd.ast.AST.SynDecl");
135        }
136        isUnknown_visited = state().boundariesCrossed;
137        try {  return false;  }
138        finally {
139          isUnknown_visited = -1;
140        }
141      }
142      /**
143       * @attribute inh
144       * @aspect PredefinedTypes
145       * @declaredat /home/csz-naf/examples/PicoJava/spec/PredefinedTypes.jrag:15
146       */
147      public PrimitiveDecl booleanType() {
148        ASTNode$State state = state();
149        if (booleanType_visited == state().boundariesCrossed) {
150          throw new RuntimeException("Circular definition of attr: booleanType in class: org.jastadd.ast.AST.InhDecl");
151        }
152        booleanType_visited = state().boundariesCrossed;
153        PrimitiveDecl booleanType_value = getParent().Define_PrimitiveDecl_booleanType(this, null);
154    
155        booleanType_visited = -1;
156        return booleanType_value;
157      }
158      /**
159       * @apilevel internal
160       */
161      protected int booleanType_visited = -1;
162      /**
163       * @apilevel internal
164       */
165      public ASTNode rewriteTo() {    return super.rewriteTo();
166      }}