1 11 12 package org.eclipse.jdt.core.dom; 13 14 import java.util.ArrayList ; 15 import java.util.List ; 16 17 46 public class QualifiedType extends Type { 47 50 int index; 51 52 55 public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = 56 new ChildPropertyDescriptor(QualifiedType.class, "qualifier", Type.class, MANDATORY, CYCLE_RISK); 58 61 public static final ChildPropertyDescriptor NAME_PROPERTY = 62 new ChildPropertyDescriptor(QualifiedType.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); 64 69 private static final List PROPERTY_DESCRIPTORS; 70 71 static { 72 List propertyList = new ArrayList (3); 73 createPropertyList(QualifiedType.class, propertyList); 74 addProperty(QUALIFIER_PROPERTY, propertyList); 75 addProperty(NAME_PROPERTY, propertyList); 76 PROPERTY_DESCRIPTORS = reapPropertyList(propertyList); 77 } 78 79 88 public static List propertyDescriptors(int apiLevel) { 89 return PROPERTY_DESCRIPTORS; 90 } 91 92 96 private Type qualifier = null; 97 98 102 private SimpleName name = null; 103 104 113 QualifiedType(AST ast) { 114 super(ast); 115 unsupportedIn2(); 116 } 117 118 121 final List internalStructuralPropertiesForType(int apiLevel) { 122 return propertyDescriptors(apiLevel); 123 } 124 125 128 final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { 129 if (property == QUALIFIER_PROPERTY) { 130 if (get) { 131 return getQualifier(); 132 } else { 133 setQualifier((Type) child); 134 return null; 135 } 136 } 137 if (property == NAME_PROPERTY) { 138 if (get) { 139 return getName(); 140 } else { 141 setName((SimpleName) child); 142 return null; 143 } 144 } 145 return super.internalGetSetChildProperty(property, get, child); 147 } 148 149 152 final int getNodeType0() { 153 return QUALIFIED_TYPE; 154 } 155 156 159 ASTNode clone0(AST target) { 160 QualifiedType result = new QualifiedType(target); 161 result.setSourceRange(this.getStartPosition(), this.getLength()); 162 result.setQualifier((Type) ((ASTNode) getQualifier()).clone(target)); 163 result.setName((SimpleName) ((ASTNode) getName()).clone(target)); 164 return result; 165 } 166 167 170 final boolean subtreeMatch0(ASTMatcher matcher, Object other) { 171 return matcher.match(this, other); 173 } 174 175 178 void accept0(ASTVisitor visitor) { 179 boolean visitChildren = visitor.visit(this); 180 if (visitChildren) { 181 acceptChild(visitor, getQualifier()); 183 acceptChild(visitor, getName()); 184 } 185 visitor.endVisit(this); 186 } 187 188 193 public Type getQualifier() { 194 if (this.qualifier == null) { 195 synchronized (this) { 197 if (this.qualifier == null) { 198 preLazyInit(); 199 this.qualifier = new SimpleType(this.ast); 200 postLazyInit(this.qualifier, QUALIFIER_PROPERTY); 201 } 202 } 203 } 204 return this.qualifier; 205 } 206 207 217 public void setQualifier(Type type) { 218 if (type == null) { 219 throw new IllegalArgumentException (); 220 } 221 ASTNode oldChild = this.qualifier; 222 preReplaceChild(oldChild, type, QUALIFIER_PROPERTY); 223 this.qualifier = type; 224 postReplaceChild(oldChild, type, QUALIFIER_PROPERTY); 225 } 226 227 232 public SimpleName getName() { 233 if (this.name == null) { 234 synchronized (this) { 236 if (this.name == null) { 237 preLazyInit(); 238 this.name = new SimpleName(this.ast); 239 postLazyInit(this.name, NAME_PROPERTY); 240 } 241 } 242 } 243 return this.name; 244 } 245 246 256 public void setName(SimpleName name) { 257 if (name == null) { 258 throw new IllegalArgumentException (); 259 } 260 ASTNode oldChild = this.name; 261 preReplaceChild(oldChild, name, NAME_PROPERTY); 262 this.name = name; 263 postReplaceChild(oldChild, name, NAME_PROPERTY); 264 } 265 266 269 int memSize() { 270 return BASE_NODE_SIZE + 3 * 4; 272 } 273 274 277 int treeSize() { 278 return 279 memSize() 280 + (this.qualifier == null ? 0 : getQualifier().treeSize()) 281 + (this.name == null ? 0 : getName().treeSize()); 282 } 283 } 284 285 | Popular Tags |