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