1 11 12 package org.eclipse.jdt.core.dom; 13 14 import java.util.ArrayList ; 15 import java.util.List ; 16 17 32 public class ThisExpression extends Expression { 33 34 38 public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = 39 new ChildPropertyDescriptor(ThisExpression.class, "qualifier", Name.class, OPTIONAL, NO_CYCLE_RISK); 41 46 private static final List PROPERTY_DESCRIPTORS; 47 48 static { 49 List propertyList = new ArrayList (2); 50 createPropertyList(ThisExpression.class, propertyList); 51 addProperty(QUALIFIER_PROPERTY, propertyList); 52 PROPERTY_DESCRIPTORS = reapPropertyList(propertyList); 53 } 54 55 65 public static List propertyDescriptors(int apiLevel) { 66 return PROPERTY_DESCRIPTORS; 67 } 68 69 72 private Name optionalQualifier = null; 73 74 80 ThisExpression(AST ast) { 81 super(ast); 82 } 83 84 87 final List internalStructuralPropertiesForType(int apiLevel) { 88 return propertyDescriptors(apiLevel); 89 } 90 91 94 final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { 95 if (property == QUALIFIER_PROPERTY) { 96 if (get) { 97 return getQualifier(); 98 } else { 99 setQualifier((Name) child); 100 return null; 101 } 102 } 103 return super.internalGetSetChildProperty(property, get, child); 105 } 106 107 110 final int getNodeType0() { 111 return THIS_EXPRESSION; 112 } 113 114 117 ASTNode clone0(AST target) { 118 ThisExpression result = new ThisExpression(target); 119 result.setSourceRange(this.getStartPosition(), this.getLength()); 120 result.setQualifier((Name) ASTNode.copySubtree(target, getQualifier())); 121 return result; 122 } 123 124 127 final boolean subtreeMatch0(ASTMatcher matcher, Object other) { 128 return matcher.match(this, other); 130 } 131 132 135 void accept0(ASTVisitor visitor) { 136 boolean visitChildren = visitor.visit(this); 137 if (visitChildren) { 138 acceptChild(visitor, getQualifier()); 139 } 140 visitor.endVisit(this); 141 } 142 143 149 public Name getQualifier() { 150 return this.optionalQualifier; 151 } 152 153 164 public void setQualifier(Name name) { 165 ASTNode oldChild = this.optionalQualifier; 166 preReplaceChild(oldChild, name, QUALIFIER_PROPERTY); 167 this.optionalQualifier = name; 168 postReplaceChild(oldChild, name, QUALIFIER_PROPERTY); 169 } 170 171 174 int memSize() { 175 return BASE_NODE_SIZE + 1 * 4; 177 } 178 179 182 int treeSize() { 183 return 184 memSize() 185 + (this.optionalQualifier == null ? 0 : getQualifier().treeSize()); 186 } 187 } 188 | Popular Tags |