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:21
010     * @production UnknownDecl : {@link TypeDecl};
011    
012     */
013    public class UnknownDecl extends TypeDecl implements Cloneable {
014      /**
015       * @apilevel internal
016       */
017      public UnknownDecl clone() throws CloneNotSupportedException {
018        UnknownDecl node = (UnknownDecl) super.clone();
019        node.isUnknown_visited = -1;
020        node.isSubtypeOf_TypeDecl_visited = null;
021        node.isSubtypeOf_TypeDecl_values = null;
022        node.isSuperTypeOf_TypeDecl_visited = null;
023        node.isSuperTypeOf_TypeDecl_values = null;
024        node.isSuperTypeOfClassDecl_ClassDecl_visited = null;
025        node.isSuperTypeOfClassDecl_ClassDecl_values = null;
026        node.in$Circle(false);
027        node.is$Final(false);
028        return node;
029      }
030      /**
031       * @apilevel internal
032       */
033      public UnknownDecl copy() {
034        try {
035          UnknownDecl node = (UnknownDecl) clone();
036          node.parent = null;
037          if(children != null) {
038            node.children = (ASTNode[]) children.clone();
039          }
040          return node;
041        } catch (CloneNotSupportedException e) {
042          throw new Error("Error: clone not supported for " + getClass().getName());
043        }
044      }
045      /**
046       * Create a deep copy of the AST subtree at this node.
047       * The copy is dangling, i.e. has no parent.
048       * @return dangling copy of the subtree at this node
049       * @apilevel low-level
050       */
051      public UnknownDecl fullCopy() {
052        UnknownDecl tree = (UnknownDecl) copy();
053        if (children != null) {
054          for (int i = 0; i < children.length; ++i) {
055            ASTNode child = (ASTNode) children[i];
056            if(child != null) {
057              child = child.fullCopy();
058              tree.setChild(child, i);
059            }
060          }
061        }
062        return tree;
063      }
064      /**
065       * @aspect PrettyPrint
066       * @declaredat /home/csz-naf/examples/PicoJava/spec/PrettyPrint.jadd:61
067       */
068      public void prettyPrint(StringBuilder sb, int t) { }
069      /**
070       */
071      public UnknownDecl() {
072        super();
073      }
074      /**
075       * Initializes the child array to the correct size.
076       * Initializes List and Opt nta children.
077       * @apilevel internal
078       * @ast method
079       */
080      public void init$Children() {
081      }
082      /**
083       */
084      public UnknownDecl(String p0) {
085        setName(p0);
086      }
087      /**
088       * @apilevel low-level
089       */
090      protected int numChildren() {
091        return 0;
092      }
093      /**
094       * @apilevel internal
095       */
096      public boolean mayHaveRewrite() {
097        return false;
098      }
099      /**
100       * @apilevel low-level
101       */
102      public void flushCache() {
103        super.flushCache();
104        isUnknown_visited = -1;
105        isSubtypeOf_TypeDecl_visited = null;
106        isSubtypeOf_TypeDecl_values = null;
107        isSuperTypeOf_TypeDecl_visited = null;
108        isSuperTypeOf_TypeDecl_values = null;
109        isSuperTypeOfClassDecl_ClassDecl_visited = null;
110        isSuperTypeOfClassDecl_ClassDecl_values = null;
111      }
112      /**
113       * @apilevel internal
114       */
115      public void flushCollectionCache() {
116        super.flushCollectionCache();
117      }
118      /**
119       * Replaces the lexeme Name.
120       * @param value The new value for the lexeme Name.
121       * @apilevel high-level
122       */
123      public void setName(String value) {
124        tokenString_Name = value;
125      }
126      /**
127       * Retrieves the value for the lexeme Name.
128       * @return The value for the lexeme Name.
129       * @apilevel high-level
130       */
131      public String getName() {
132        return tokenString_Name != null ? tokenString_Name : "";
133      }
134      /**
135       * @apilevel internal
136       */
137      protected int isUnknown_visited = -1;
138      /**
139       * @attribute syn
140       * @aspect NullObjects
141       * @declaredat /home/csz-naf/examples/PicoJava/spec/NullObjects.jrag:5
142       */
143      public boolean isUnknown() {
144        ASTNode$State state = state();
145        if (isUnknown_visited == state().boundariesCrossed) {
146          throw new RuntimeException("Circular definition of attr: isUnknown in class: org.jastadd.ast.AST.SynDecl");
147        }
148        isUnknown_visited = state().boundariesCrossed;
149        try {  return true;  }
150        finally {
151          isUnknown_visited = -1;
152        }
153      }
154      /**
155       * @apilevel internal
156       */
157      protected java.util.Map isSubtypeOf_TypeDecl_visited;
158      protected java.util.Map isSubtypeOf_TypeDecl_values;
159      /**
160       * @attribute syn
161       * @aspect NullObjects
162       * @declaredat /home/csz-naf/examples/PicoJava/spec/NullObjects.jrag:10
163       */
164      public boolean isSubtypeOf(TypeDecl typeDecl) {
165        Object _parameters = typeDecl;
166        if(isSubtypeOf_TypeDecl_visited == null) isSubtypeOf_TypeDecl_visited = new java.util.HashMap(4);
167        if(isSubtypeOf_TypeDecl_values == null) isSubtypeOf_TypeDecl_values = new java.util.HashMap(4);
168        if(isSubtypeOf_TypeDecl_values.containsKey(_parameters)) {
169          return ((Boolean)isSubtypeOf_TypeDecl_values.get(_parameters)).booleanValue();
170        }
171        ASTNode$State state = state();
172        if (Integer.valueOf(state().boundariesCrossed).equals(isSubtypeOf_TypeDecl_visited.get(_parameters))) {
173          throw new RuntimeException("Circular definition of attr: isSubtypeOf in class: org.jastadd.ast.AST.SynDecl");
174        }
175        isSubtypeOf_TypeDecl_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed));
176        int num = state.boundariesCrossed;
177        boolean isFinal = this.is$Final();
178        boolean isSubtypeOf_TypeDecl_value = isSubtypeOf_compute(typeDecl);
179        if(isFinal && num == state().boundariesCrossed) {
180          isSubtypeOf_TypeDecl_values.put(_parameters, Boolean.valueOf(isSubtypeOf_TypeDecl_value));
181        } else {
182        }
183    
184        isSubtypeOf_TypeDecl_visited.remove(_parameters);
185        return isSubtypeOf_TypeDecl_value;
186      }
187      /**
188       * @apilevel internal
189       */
190      private boolean isSubtypeOf_compute(TypeDecl typeDecl) {  return true;  }
191      /**
192       * @apilevel internal
193       */
194      protected java.util.Map isSuperTypeOf_TypeDecl_visited;
195      protected java.util.Map isSuperTypeOf_TypeDecl_values;
196      /**
197       * @attribute syn
198       * @aspect NullObjects
199       * @declaredat /home/csz-naf/examples/PicoJava/spec/NullObjects.jrag:11
200       */
201      public boolean isSuperTypeOf(TypeDecl typeDecl) {
202        Object _parameters = typeDecl;
203        if(isSuperTypeOf_TypeDecl_visited == null) isSuperTypeOf_TypeDecl_visited = new java.util.HashMap(4);
204        if(isSuperTypeOf_TypeDecl_values == null) isSuperTypeOf_TypeDecl_values = new java.util.HashMap(4);
205        if(isSuperTypeOf_TypeDecl_values.containsKey(_parameters)) {
206          return ((Boolean)isSuperTypeOf_TypeDecl_values.get(_parameters)).booleanValue();
207        }
208        ASTNode$State state = state();
209        if (Integer.valueOf(state().boundariesCrossed).equals(isSuperTypeOf_TypeDecl_visited.get(_parameters))) {
210          throw new RuntimeException("Circular definition of attr: isSuperTypeOf in class: org.jastadd.ast.AST.SynDecl");
211        }
212        isSuperTypeOf_TypeDecl_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed));
213        int num = state.boundariesCrossed;
214        boolean isFinal = this.is$Final();
215        boolean isSuperTypeOf_TypeDecl_value = isSuperTypeOf_compute(typeDecl);
216        if(isFinal && num == state().boundariesCrossed) {
217          isSuperTypeOf_TypeDecl_values.put(_parameters, Boolean.valueOf(isSuperTypeOf_TypeDecl_value));
218        } else {
219        }
220    
221        isSuperTypeOf_TypeDecl_visited.remove(_parameters);
222        return isSuperTypeOf_TypeDecl_value;
223      }
224      /**
225       * @apilevel internal
226       */
227      private boolean isSuperTypeOf_compute(TypeDecl typeDecl) {  return true;  }
228      /**
229       * @apilevel internal
230       */
231      protected java.util.Map isSuperTypeOfClassDecl_ClassDecl_visited;
232      protected java.util.Map isSuperTypeOfClassDecl_ClassDecl_values;
233      /**
234       * @attribute syn
235       * @aspect NullObjects
236       * @declaredat /home/csz-naf/examples/PicoJava/spec/NullObjects.jrag:12
237       */
238      public boolean isSuperTypeOfClassDecl(ClassDecl typeDecl) {
239        Object _parameters = typeDecl;
240        if(isSuperTypeOfClassDecl_ClassDecl_visited == null) isSuperTypeOfClassDecl_ClassDecl_visited = new java.util.HashMap(4);
241        if(isSuperTypeOfClassDecl_ClassDecl_values == null) isSuperTypeOfClassDecl_ClassDecl_values = new java.util.HashMap(4);
242        if(isSuperTypeOfClassDecl_ClassDecl_values.containsKey(_parameters)) {
243          return ((Boolean)isSuperTypeOfClassDecl_ClassDecl_values.get(_parameters)).booleanValue();
244        }
245        ASTNode$State state = state();
246        if (Integer.valueOf(state().boundariesCrossed).equals(isSuperTypeOfClassDecl_ClassDecl_visited.get(_parameters))) {
247          throw new RuntimeException("Circular definition of attr: isSuperTypeOfClassDecl in class: org.jastadd.ast.AST.SynDecl");
248        }
249        isSuperTypeOfClassDecl_ClassDecl_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed));
250        int num = state.boundariesCrossed;
251        boolean isFinal = this.is$Final();
252        boolean isSuperTypeOfClassDecl_ClassDecl_value = isSuperTypeOfClassDecl_compute(typeDecl);
253        if(isFinal && num == state().boundariesCrossed) {
254          isSuperTypeOfClassDecl_ClassDecl_values.put(_parameters, Boolean.valueOf(isSuperTypeOfClassDecl_ClassDecl_value));
255        } else {
256        }
257    
258        isSuperTypeOfClassDecl_ClassDecl_visited.remove(_parameters);
259        return isSuperTypeOfClassDecl_ClassDecl_value;
260      }
261      /**
262       * @apilevel internal
263       */
264      private boolean isSuperTypeOfClassDecl_compute(ClassDecl typeDecl) {  return true;  }
265      /**
266       * @apilevel internal
267       */
268      public ASTNode rewriteTo() {    return super.rewriteTo();
269      }}