001 /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */ 002 package AST; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.*; 007 import beaver.*; 008 import java.util.ArrayList; 009 import java.util.zip.*; 010 import java.io.*; 011 import java.io.FileNotFoundException; 012 import java.util.Collection; 013 /** 014 * 7.5 Import Declarations 015 * @production StaticImportDecl : {@link ImportDecl}; 016 * @ast node 017 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/StaticImports.ast:4 018 */ 019 public abstract class StaticImportDecl extends ImportDecl implements Cloneable { 020 /** 021 * @apilevel low-level 022 */ 023 public void flushCache() { 024 } 025 /** 026 * @apilevel internal 027 */ 028 public void flushCollectionCache() { 029 } 030 /** 031 * @apilevel internal 032 */ 033 @SuppressWarnings({"unchecked", "cast"}) 034 public StaticImportDecl clone() throws CloneNotSupportedException { 035 StaticImportDecl node = (StaticImportDecl)super.clone(); 036 node.importedTypes_String_values = null; 037 node.importedFields_String_values = null; 038 node.importedMethods_String_values = null; 039 node.in$Circle(false); 040 node.is$Final(false); 041 return node; 042 } 043 /** 044 * @ast method 045 * 046 */ 047 public StaticImportDecl() { 048 super(); 049 050 051 } 052 /** 053 * Initializes the child array to the correct size. 054 * Initializes List and Opt nta children. 055 * @apilevel internal 056 * @ast method 057 * @ast method 058 * 059 */ 060 public void init$Children() { 061 children = new ASTNode[1]; 062 } 063 /** 064 * @ast method 065 * 066 */ 067 public StaticImportDecl(Access p0) { 068 setChild(p0, 0); 069 } 070 /** 071 * @apilevel low-level 072 * @ast method 073 * 074 */ 075 protected int numChildren() { 076 return 1; 077 } 078 /** 079 * @apilevel internal 080 * @ast method 081 * 082 */ 083 public boolean mayHaveRewrite() { 084 return false; 085 } 086 /** 087 * Replaces the Access child. 088 * @param node The new node to replace the Access child. 089 * @apilevel high-level 090 * @ast method 091 * 092 */ 093 public void setAccess(Access node) { 094 setChild(node, 0); 095 } 096 /** 097 * Retrieves the Access child. 098 * @return The current node used as the Access child. 099 * @apilevel high-level 100 * @ast method 101 * 102 */ 103 public Access getAccess() { 104 return (Access)getChild(0); 105 } 106 /** 107 * Retrieves the Access child. 108 * <p><em>This method does not invoke AST transformations.</em></p> 109 * @return The current node used as the Access child. 110 * @apilevel low-level 111 * @ast method 112 * 113 */ 114 public Access getAccessNoTransform() { 115 return (Access)getChildNoTransform(0); 116 } 117 /** 118 * @attribute syn 119 * @aspect StaticImports 120 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/StaticImports.jrag:53 121 */ 122 @SuppressWarnings({"unchecked", "cast"}) 123 public abstract TypeDecl type(); 124 protected java.util.Map importedTypes_String_values; 125 /* 7.5.3 A single-static-import declaration imports all accessible (\ufffd6.6) static members 126 with a given simple name from a type. This makes these static members available 127 under their simple name in the class and interface declarations of the 128 compilation unit in which the single-static import declaration appears.* @attribute syn 129 * @aspect StaticImports 130 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/StaticImports.jrag:21 131 */ 132 @SuppressWarnings({"unchecked", "cast"}) 133 public SimpleSet importedTypes(String name) { 134 Object _parameters = name; 135 if(importedTypes_String_values == null) importedTypes_String_values = new java.util.HashMap(4); 136 if(importedTypes_String_values.containsKey(_parameters)) { 137 return (SimpleSet)importedTypes_String_values.get(_parameters); 138 } 139 ASTNode$State state = state(); 140 int num = state.boundariesCrossed; 141 boolean isFinal = this.is$Final(); 142 SimpleSet importedTypes_String_value = importedTypes_compute(name); 143 if(isFinal && num == state().boundariesCrossed){ importedTypes_String_values.put(_parameters, importedTypes_String_value); } 144 return importedTypes_String_value; 145 } 146 /** 147 * @apilevel internal 148 */ 149 private SimpleSet importedTypes_compute(String name) { 150 SimpleSet set = SimpleSet.emptySet; 151 for(Iterator iter = type().memberTypes(name).iterator(); iter.hasNext(); ) { 152 TypeDecl decl = (TypeDecl)iter.next(); 153 if(decl.isStatic() && decl.accessibleFromPackage(packageName())) 154 set = set.add(decl); 155 } 156 return set; 157 } 158 protected java.util.Map importedFields_String_values; 159 /** 160 * @attribute syn 161 * @aspect StaticImports 162 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/StaticImports.jrag:31 163 */ 164 @SuppressWarnings({"unchecked", "cast"}) 165 public SimpleSet importedFields(String name) { 166 Object _parameters = name; 167 if(importedFields_String_values == null) importedFields_String_values = new java.util.HashMap(4); 168 if(importedFields_String_values.containsKey(_parameters)) { 169 return (SimpleSet)importedFields_String_values.get(_parameters); 170 } 171 ASTNode$State state = state(); 172 int num = state.boundariesCrossed; 173 boolean isFinal = this.is$Final(); 174 SimpleSet importedFields_String_value = importedFields_compute(name); 175 if(isFinal && num == state().boundariesCrossed){ importedFields_String_values.put(_parameters, importedFields_String_value); } 176 return importedFields_String_value; 177 } 178 /** 179 * @apilevel internal 180 */ 181 private SimpleSet importedFields_compute(String name) { 182 SimpleSet set = SimpleSet.emptySet; 183 for(Iterator iter = type().memberFields(name).iterator(); iter.hasNext(); ) { 184 FieldDeclaration decl = (FieldDeclaration)iter.next(); 185 if(decl.isStatic() && 186 (decl.isPublic() || (!decl.isPrivate() && decl.hostType().topLevelType().packageName().equals(packageName())))) 187 set = set.add(decl); 188 } 189 return set; 190 } 191 protected java.util.Map importedMethods_String_values; 192 /** 193 * @attribute syn 194 * @aspect StaticImports 195 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/StaticImports.jrag:42 196 */ 197 @SuppressWarnings({"unchecked", "cast"}) 198 public Collection importedMethods(String name) { 199 Object _parameters = name; 200 if(importedMethods_String_values == null) importedMethods_String_values = new java.util.HashMap(4); 201 if(importedMethods_String_values.containsKey(_parameters)) { 202 return (Collection)importedMethods_String_values.get(_parameters); 203 } 204 ASTNode$State state = state(); 205 int num = state.boundariesCrossed; 206 boolean isFinal = this.is$Final(); 207 Collection importedMethods_String_value = importedMethods_compute(name); 208 if(isFinal && num == state().boundariesCrossed){ importedMethods_String_values.put(_parameters, importedMethods_String_value); } 209 return importedMethods_String_value; 210 } 211 /** 212 * @apilevel internal 213 */ 214 private Collection importedMethods_compute(String name) { 215 Collection set = new HashSet(); 216 for(Iterator iter = type().memberMethods(name).iterator(); iter.hasNext(); ) { 217 MethodDecl decl = (MethodDecl)iter.next(); 218 if(decl.isStatic() && 219 (decl.isPublic() || (!decl.isPrivate() && decl.hostType().topLevelType().packageName().equals(packageName())))) 220 set.add(decl); 221 } 222 return set; 223 } 224 /** 225 * @apilevel internal 226 */ 227 public ASTNode rewriteTo() { 228 return super.rewriteTo(); 229 } 230 }