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:7 010 * @production TypeDecl : {@link Decl}; 011 012 */ 013 public abstract class TypeDecl extends Decl implements Cloneable { 014 /** 015 * @apilevel internal 016 */ 017 public TypeDecl clone() throws CloneNotSupportedException { 018 TypeDecl node = (TypeDecl) super.clone(); 019 node.remoteLookup_String_visited = null; 020 node.type_visited = -1; 021 node.type_computed = false; 022 node.type_value = null; 023 node.isSubtypeOf_TypeDecl_visited = null; 024 node.isSubtypeOf_TypeDecl_values = null; 025 node.isSuperTypeOf_TypeDecl_visited = null; 026 node.isSuperTypeOf_TypeDecl_values = null; 027 node.isSuperTypeOfClassDecl_ClassDecl_visited = null; 028 node.isSuperTypeOfClassDecl_ClassDecl_values = null; 029 node.isQualified_visited = -1; 030 node.qualifier_visited = -1; 031 node.lookup_String_visited = null; 032 node.unknownDecl_visited = -1; 033 node.in$Circle(false); 034 node.is$Final(false); 035 return node; 036 } 037 /** 038 */ 039 public TypeDecl() { 040 super(); 041 } 042 /** 043 * Initializes the child array to the correct size. 044 * Initializes List and Opt nta children. 045 * @apilevel internal 046 * @ast method 047 */ 048 public void init$Children() { 049 } 050 /** 051 */ 052 public TypeDecl(String p0) { 053 setName(p0); 054 } 055 /** 056 * @apilevel low-level 057 */ 058 protected int numChildren() { 059 return 0; 060 } 061 /** 062 * @apilevel internal 063 */ 064 public boolean mayHaveRewrite() { 065 return false; 066 } 067 /** 068 * @apilevel low-level 069 */ 070 public void flushCache() { 071 super.flushCache(); 072 remoteLookup_String_visited = null; 073 type_visited = -1; 074 type_computed = false; 075 type_value = null; 076 isSubtypeOf_TypeDecl_visited = null; 077 isSubtypeOf_TypeDecl_values = null; 078 isSuperTypeOf_TypeDecl_visited = null; 079 isSuperTypeOf_TypeDecl_values = null; 080 isSuperTypeOfClassDecl_ClassDecl_visited = null; 081 isSuperTypeOfClassDecl_ClassDecl_values = null; 082 isQualified_visited = -1; 083 qualifier_visited = -1; 084 lookup_String_visited = null; 085 unknownDecl_visited = -1; 086 } 087 /** 088 * @apilevel internal 089 */ 090 public void flushCollectionCache() { 091 super.flushCollectionCache(); 092 } 093 /** 094 * Replaces the lexeme Name. 095 * @param value The new value for the lexeme Name. 096 * @apilevel high-level 097 */ 098 public void setName(String value) { 099 tokenString_Name = value; 100 } 101 /** 102 * Retrieves the value for the lexeme Name. 103 * @return The value for the lexeme Name. 104 * @apilevel high-level 105 */ 106 public String getName() { 107 return tokenString_Name != null ? tokenString_Name : ""; 108 } 109 /** 110 * @apilevel internal 111 */ 112 protected java.util.Map remoteLookup_String_visited; 113 /** 114 * @attribute syn 115 * @aspect NameResolution 116 * @declaredat /home/csz-naf/examples/PicoJava/spec/NameResolution.jrag:62 117 */ 118 public Decl remoteLookup(String name) { 119 Object _parameters = name; 120 if(remoteLookup_String_visited == null) remoteLookup_String_visited = new java.util.HashMap(4); 121 ASTNode$State state = state(); 122 if (Integer.valueOf(state().boundariesCrossed).equals(remoteLookup_String_visited.get(_parameters))) { 123 throw new RuntimeException("Circular definition of attr: remoteLookup in class: org.jastadd.ast.AST.SynDecl"); 124 } 125 remoteLookup_String_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed)); 126 try { return unknownDecl(); } 127 finally { 128 remoteLookup_String_visited.remove(_parameters); 129 } 130 } 131 /** 132 * @apilevel internal 133 */ 134 protected int type_visited = -1; 135 /** 136 * @apilevel internal 137 */ 138 protected boolean type_computed = false; 139 /** 140 * @apilevel internal 141 */ 142 protected TypeDecl type_value; 143 /** 144 * @attribute syn 145 * @aspect TypeAnalysis 146 * @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:33 147 */ 148 public TypeDecl type() { 149 if(type_computed) { 150 return type_value; 151 } 152 ASTNode$State state = state(); 153 if (type_visited == state().boundariesCrossed) { 154 throw new RuntimeException("Circular definition of attr: type in class: org.jastadd.ast.AST.SynDecl"); 155 } 156 type_visited = state().boundariesCrossed; 157 int num = state.boundariesCrossed; 158 boolean isFinal = this.is$Final(); 159 type_value = type_compute(); 160 if(isFinal && num == state().boundariesCrossed) { 161 type_computed = true; 162 } else { 163 } 164 165 type_visited = -1; 166 return type_value; 167 } 168 /** 169 * @apilevel internal 170 */ 171 private TypeDecl type_compute() { return this; } 172 /** 173 * @apilevel internal 174 */ 175 protected java.util.Map isSubtypeOf_TypeDecl_visited; 176 protected java.util.Map isSubtypeOf_TypeDecl_values; 177 /** 178 * @attribute syn 179 * @aspect TypeAnalysis 180 * @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:43 181 */ 182 public boolean isSubtypeOf(TypeDecl typeDecl) { 183 Object _parameters = typeDecl; 184 if(isSubtypeOf_TypeDecl_visited == null) isSubtypeOf_TypeDecl_visited = new java.util.HashMap(4); 185 if(isSubtypeOf_TypeDecl_values == null) isSubtypeOf_TypeDecl_values = new java.util.HashMap(4); 186 if(isSubtypeOf_TypeDecl_values.containsKey(_parameters)) { 187 return ((Boolean)isSubtypeOf_TypeDecl_values.get(_parameters)).booleanValue(); 188 } 189 ASTNode$State state = state(); 190 if (Integer.valueOf(state().boundariesCrossed).equals(isSubtypeOf_TypeDecl_visited.get(_parameters))) { 191 throw new RuntimeException("Circular definition of attr: isSubtypeOf in class: org.jastadd.ast.AST.SynDecl"); 192 } 193 isSubtypeOf_TypeDecl_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed)); 194 int num = state.boundariesCrossed; 195 boolean isFinal = this.is$Final(); 196 boolean isSubtypeOf_TypeDecl_value = isSubtypeOf_compute(typeDecl); 197 if(isFinal && num == state().boundariesCrossed) { 198 isSubtypeOf_TypeDecl_values.put(_parameters, Boolean.valueOf(isSubtypeOf_TypeDecl_value)); 199 } else { 200 } 201 202 isSubtypeOf_TypeDecl_visited.remove(_parameters); 203 return isSubtypeOf_TypeDecl_value; 204 } 205 /** 206 * @apilevel internal 207 */ 208 private boolean isSubtypeOf_compute(TypeDecl typeDecl) { return typeDecl.isSuperTypeOf(this); } 209 /** 210 * @apilevel internal 211 */ 212 protected java.util.Map isSuperTypeOf_TypeDecl_visited; 213 protected java.util.Map isSuperTypeOf_TypeDecl_values; 214 /** 215 * @attribute syn 216 * @aspect TypeAnalysis 217 * @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:46 218 */ 219 public boolean isSuperTypeOf(TypeDecl typeDecl) { 220 Object _parameters = typeDecl; 221 if(isSuperTypeOf_TypeDecl_visited == null) isSuperTypeOf_TypeDecl_visited = new java.util.HashMap(4); 222 if(isSuperTypeOf_TypeDecl_values == null) isSuperTypeOf_TypeDecl_values = new java.util.HashMap(4); 223 if(isSuperTypeOf_TypeDecl_values.containsKey(_parameters)) { 224 return ((Boolean)isSuperTypeOf_TypeDecl_values.get(_parameters)).booleanValue(); 225 } 226 ASTNode$State state = state(); 227 if (Integer.valueOf(state().boundariesCrossed).equals(isSuperTypeOf_TypeDecl_visited.get(_parameters))) { 228 throw new RuntimeException("Circular definition of attr: isSuperTypeOf in class: org.jastadd.ast.AST.SynDecl"); 229 } 230 isSuperTypeOf_TypeDecl_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed)); 231 int num = state.boundariesCrossed; 232 boolean isFinal = this.is$Final(); 233 boolean isSuperTypeOf_TypeDecl_value = isSuperTypeOf_compute(typeDecl); 234 if(isFinal && num == state().boundariesCrossed) { 235 isSuperTypeOf_TypeDecl_values.put(_parameters, Boolean.valueOf(isSuperTypeOf_TypeDecl_value)); 236 } else { 237 } 238 239 isSuperTypeOf_TypeDecl_visited.remove(_parameters); 240 return isSuperTypeOf_TypeDecl_value; 241 } 242 /** 243 * @apilevel internal 244 */ 245 private boolean isSuperTypeOf_compute(TypeDecl typeDecl) { return this == typeDecl; } 246 /** 247 * @apilevel internal 248 */ 249 protected java.util.Map isSuperTypeOfClassDecl_ClassDecl_visited; 250 protected java.util.Map isSuperTypeOfClassDecl_ClassDecl_values; 251 /** 252 * @attribute syn 253 * @aspect TypeAnalysis 254 * @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:47 255 */ 256 public boolean isSuperTypeOfClassDecl(ClassDecl typeDecl) { 257 Object _parameters = typeDecl; 258 if(isSuperTypeOfClassDecl_ClassDecl_visited == null) isSuperTypeOfClassDecl_ClassDecl_visited = new java.util.HashMap(4); 259 if(isSuperTypeOfClassDecl_ClassDecl_values == null) isSuperTypeOfClassDecl_ClassDecl_values = new java.util.HashMap(4); 260 if(isSuperTypeOfClassDecl_ClassDecl_values.containsKey(_parameters)) { 261 return ((Boolean)isSuperTypeOfClassDecl_ClassDecl_values.get(_parameters)).booleanValue(); 262 } 263 ASTNode$State state = state(); 264 if (Integer.valueOf(state().boundariesCrossed).equals(isSuperTypeOfClassDecl_ClassDecl_visited.get(_parameters))) { 265 throw new RuntimeException("Circular definition of attr: isSuperTypeOfClassDecl in class: org.jastadd.ast.AST.SynDecl"); 266 } 267 isSuperTypeOfClassDecl_ClassDecl_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed)); 268 int num = state.boundariesCrossed; 269 boolean isFinal = this.is$Final(); 270 boolean isSuperTypeOfClassDecl_ClassDecl_value = isSuperTypeOfClassDecl_compute(typeDecl); 271 if(isFinal && num == state().boundariesCrossed) { 272 isSuperTypeOfClassDecl_ClassDecl_values.put(_parameters, Boolean.valueOf(isSuperTypeOfClassDecl_ClassDecl_value)); 273 } else { 274 } 275 276 isSuperTypeOfClassDecl_ClassDecl_visited.remove(_parameters); 277 return isSuperTypeOfClassDecl_ClassDecl_value; 278 } 279 /** 280 * @apilevel internal 281 */ 282 private boolean isSuperTypeOfClassDecl_compute(ClassDecl typeDecl) { return this == typeDecl || typeDecl.superClass() != null && typeDecl.superClass().isSubtypeOf(this); } 283 /** 284 * @attribute inh 285 * @aspect ErrorCheck 286 * @declaredat /home/csz-naf/examples/PicoJava/spec/ErrorCheck.jadd:59 287 */ 288 public boolean isQualified() { 289 ASTNode$State state = state(); 290 if (isQualified_visited == state().boundariesCrossed) { 291 throw new RuntimeException("Circular definition of attr: isQualified in class: org.jastadd.ast.AST.InhDecl"); 292 } 293 isQualified_visited = state().boundariesCrossed; 294 boolean isQualified_value = getParent().Define_boolean_isQualified(this, null); 295 296 isQualified_visited = -1; 297 return isQualified_value; 298 } 299 /** 300 * @apilevel internal 301 */ 302 protected int isQualified_visited = -1; 303 /** 304 * @attribute inh 305 * @aspect ErrorCheck 306 * @declaredat /home/csz-naf/examples/PicoJava/spec/ErrorCheck.jadd:69 307 */ 308 public Access qualifier() { 309 ASTNode$State state = state(); 310 if (qualifier_visited == state().boundariesCrossed) { 311 throw new RuntimeException("Circular definition of attr: qualifier in class: org.jastadd.ast.AST.InhDecl"); 312 } 313 qualifier_visited = state().boundariesCrossed; 314 Access qualifier_value = getParent().Define_Access_qualifier(this, null); 315 316 qualifier_visited = -1; 317 return qualifier_value; 318 } 319 /** 320 * @apilevel internal 321 */ 322 protected int qualifier_visited = -1; 323 /** 324 * @attribute inh 325 * @aspect NameResolution 326 * @declaredat /home/csz-naf/examples/PicoJava/spec/NameResolution.jrag:80 327 */ 328 public Decl lookup(String name) { 329 Object _parameters = name; 330 if(lookup_String_visited == null) lookup_String_visited = new java.util.HashMap(4); 331 ASTNode$State state = state(); 332 if (Integer.valueOf(state().boundariesCrossed).equals(lookup_String_visited.get(_parameters))) { 333 throw new RuntimeException("Circular definition of attr: lookup in class: org.jastadd.ast.AST.InhDecl"); 334 } 335 lookup_String_visited.put(_parameters, Integer.valueOf(state().boundariesCrossed)); 336 Decl lookup_String_value = getParent().Define_Decl_lookup(this, null, name); 337 338 lookup_String_visited.remove(_parameters); 339 return lookup_String_value; 340 } 341 /** 342 * @apilevel internal 343 */ 344 protected java.util.Map lookup_String_visited; 345 /** 346 * @attribute inh 347 * @aspect NullObjects 348 * @declaredat /home/csz-naf/examples/PicoJava/spec/NullObjects.jrag:20 349 */ 350 public Decl unknownDecl() { 351 ASTNode$State state = state(); 352 if (unknownDecl_visited == state().boundariesCrossed) { 353 throw new RuntimeException("Circular definition of attr: unknownDecl in class: org.jastadd.ast.AST.InhDecl"); 354 } 355 unknownDecl_visited = state().boundariesCrossed; 356 Decl unknownDecl_value = getParent().Define_Decl_unknownDecl(this, null); 357 358 unknownDecl_visited = -1; 359 return unknownDecl_value; 360 } 361 /** 362 * @apilevel internal 363 */ 364 protected int unknownDecl_visited = -1; 365 /** 366 * @apilevel internal 367 */ 368 public ASTNode rewriteTo() { return super.rewriteTo(); 369 }}