1 11 12 package org.eclipse.jdt.core.dom; 13 14 import java.util.ArrayList ; 15 import java.util.List ; 16 17 35 public final class TagElement extends ASTNode implements IDocElement { 36 37 42 public static final SimplePropertyDescriptor TAG_NAME_PROPERTY = 43 new SimplePropertyDescriptor(TagElement.class, "tagName", String .class, OPTIONAL); 45 49 public static final ChildListPropertyDescriptor FRAGMENTS_PROPERTY = 50 new ChildListPropertyDescriptor(TagElement.class, "fragments", IDocElement.class, CYCLE_RISK); 52 58 private static final List PROPERTY_DESCRIPTORS; 59 60 static { 61 List propertyList = new ArrayList (3); 62 createPropertyList(TagElement.class, propertyList); 63 addProperty(TAG_NAME_PROPERTY, propertyList); 64 addProperty(FRAGMENTS_PROPERTY, propertyList); 65 PROPERTY_DESCRIPTORS = reapPropertyList(propertyList); 66 } 67 68 78 public static List propertyDescriptors(int apiLevel) { 79 return PROPERTY_DESCRIPTORS; 80 } 81 82 85 public static final String TAG_AUTHOR = "@author"; 87 94 public static final String TAG_CODE = "@code"; 96 99 public static final String TAG_DEPRECATED = "@deprecated"; 101 104 public static final String TAG_DOCROOT = "@docRoot"; 106 109 public static final String TAG_EXCEPTION = "@exception"; 111 114 public static final String TAG_INHERITDOC = "@inheritDoc"; 116 119 public static final String TAG_LINK = "@link"; 121 124 public static final String TAG_LINKPLAIN = "@linkplain"; 126 133 public static final String TAG_LITERAL = "@literal"; 135 138 public static final String TAG_PARAM = "@param"; 140 143 public static final String TAG_RETURN = "@return"; 145 148 public static final String TAG_SEE = "@see"; 150 153 public static final String TAG_SERIAL = "@serial"; 155 158 public static final String TAG_SERIALDATA= "@serialData"; 160 163 public static final String TAG_SERIALFIELD= "@serialField"; 165 168 public static final String TAG_SINCE = "@since"; 170 173 public static final String TAG_THROWS = "@throws"; 175 178 public static final String TAG_VALUE= "@value"; 180 183 public static final String TAG_VERSION = "@version"; 185 188 private String optionalTagName = null; 189 190 194 private ASTNode.NodeList fragments = 195 new ASTNode.NodeList(FRAGMENTS_PROPERTY); 196 197 208 TagElement(AST ast) { 209 super(ast); 210 } 211 212 215 final List internalStructuralPropertiesForType(int apiLevel) { 216 return propertyDescriptors(apiLevel); 217 } 218 219 222 final Object internalGetSetObjectProperty(SimplePropertyDescriptor property, boolean get, Object value) { 223 if (property == TAG_NAME_PROPERTY) { 224 if (get) { 225 return getTagName(); 226 } else { 227 setTagName((String ) value); 228 return null; 229 } 230 } 231 return super.internalGetSetObjectProperty(property, get, value); 233 } 234 235 238 final List internalGetChildListProperty(ChildListPropertyDescriptor property) { 239 if (property == FRAGMENTS_PROPERTY) { 240 return fragments(); 241 } 242 return super.internalGetChildListProperty(property); 244 } 245 246 249 final int getNodeType0() { 250 return TAG_ELEMENT; 251 } 252 253 256 ASTNode clone0(AST target) { 257 TagElement result = new TagElement(target); 258 result.setSourceRange(this.getStartPosition(), this.getLength()); 259 result.setTagName(getTagName()); 260 result.fragments().addAll(ASTNode.copySubtrees(target, fragments())); 261 return result; 262 } 263 264 267 final boolean subtreeMatch0(ASTMatcher matcher, Object other) { 268 return matcher.match(this, other); 270 } 271 272 275 void accept0(ASTVisitor visitor) { 276 boolean visitChildren = visitor.visit(this); 277 if (visitChildren) { 278 acceptChildren(visitor, this.fragments); 279 } 280 visitor.endVisit(this); 281 } 282 283 295 public String getTagName() { 296 return this.optionalTagName; 297 } 298 299 311 public void setTagName(String tagName) { 312 preValueChange(TAG_NAME_PROPERTY); 313 this.optionalTagName = tagName; 314 postValueChange(TAG_NAME_PROPERTY); 315 } 316 317 360 public List fragments() { 361 return this.fragments; 362 } 363 364 381 public boolean isNested() { 382 return (getParent() instanceof TagElement); 383 } 384 385 388 int memSize() { 389 int size = BASE_NODE_SIZE + 2 * 4 + stringSize(this.optionalTagName); 390 return size; 391 } 392 393 396 int treeSize() { 397 return memSize() + this.fragments.listSize(); 398 } 399 } 400 | Popular Tags |