1 11 12 package org.eclipse.jdt.core.dom; 13 14 import java.util.ArrayList ; 15 import java.util.List ; 16 17 27 public class Block extends Statement { 28 29 33 public static final ChildListPropertyDescriptor STATEMENTS_PROPERTY = 34 new ChildListPropertyDescriptor(Block.class, "statements", Statement.class, CYCLE_RISK); 36 41 private static final List PROPERTY_DESCRIPTORS; 42 43 static { 44 List properyList = new ArrayList (2); 45 createPropertyList(Block.class, properyList); 46 addProperty(STATEMENTS_PROPERTY, properyList); 47 PROPERTY_DESCRIPTORS = reapPropertyList(properyList); 48 } 49 50 60 public static List propertyDescriptors(int apiLevel) { 61 return PROPERTY_DESCRIPTORS; 62 } 63 64 68 private ASTNode.NodeList statements = 69 new ASTNode.NodeList(STATEMENTS_PROPERTY); 70 71 80 Block(AST ast) { 81 super(ast); 82 } 83 84 87 final List internalStructuralPropertiesForType(int apiLevel) { 88 return propertyDescriptors(apiLevel); 89 } 90 91 94 final List internalGetChildListProperty(ChildListPropertyDescriptor property) { 95 if (property == STATEMENTS_PROPERTY) { 96 return statements(); 97 } 98 return super.internalGetChildListProperty(property); 100 } 101 102 105 final int getNodeType0() { 106 return BLOCK; 107 } 108 109 112 ASTNode clone0(AST target) { 113 Block result = new Block(target); 114 result.setSourceRange(this.getStartPosition(), this.getLength()); 115 result.copyLeadingComment(this); 116 result.statements().addAll( 117 ASTNode.copySubtrees(target, statements())); 118 return result; 119 } 120 121 124 final boolean subtreeMatch0(ASTMatcher matcher, Object other) { 125 return matcher.match(this, other); 127 } 128 129 132 void accept0(ASTVisitor visitor) { 133 boolean visitChildren = visitor.visit(this); 134 if (visitChildren) { 135 acceptChildren(visitor, this.statements); 136 } 137 visitor.endVisit(this); 138 } 139 140 150 public List statements() { 151 return this.statements; 152 } 153 154 157 int memSize() { 158 return super.memSize() + 1 * 4; 159 } 160 161 164 int treeSize() { 165 return memSize() + this.statements.listSize(); 166 } 167 } 168 169 | Popular Tags |