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 ArrayInitializer extends Expression { 28 29 33 public static final ChildListPropertyDescriptor EXPRESSIONS_PROPERTY = 34 new ChildListPropertyDescriptor(ArrayInitializer.class, "expressions", Expression.class, CYCLE_RISK); 36 41 private static final List PROPERTY_DESCRIPTORS; 42 43 static { 44 List properyList = new ArrayList (2); 45 createPropertyList(ArrayInitializer.class, properyList); 46 addProperty(EXPRESSIONS_PROPERTY, properyList); 47 PROPERTY_DESCRIPTORS = reapPropertyList(properyList); 48 } 49 50 61 public static List propertyDescriptors(int apiLevel) { 62 return PROPERTY_DESCRIPTORS; 63 } 64 65 69 private ASTNode.NodeList expressions = 70 new ASTNode.NodeList(EXPRESSIONS_PROPERTY); 71 72 78 ArrayInitializer(AST ast) { 79 super(ast); 80 } 81 82 85 final List internalStructuralPropertiesForType(int apiLevel) { 86 return propertyDescriptors(apiLevel); 87 } 88 89 92 final List internalGetChildListProperty(ChildListPropertyDescriptor property) { 93 if (property == EXPRESSIONS_PROPERTY) { 94 return expressions(); 95 } 96 return super.internalGetChildListProperty(property); 98 } 99 100 103 final int getNodeType0() { 104 return ARRAY_INITIALIZER; 105 } 106 107 110 ASTNode clone0(AST target) { 111 ArrayInitializer result = new ArrayInitializer(target); 112 result.setSourceRange(this.getStartPosition(), this.getLength()); 113 result.expressions().addAll(ASTNode.copySubtrees(target, expressions())); 114 return result; 115 } 116 117 120 final boolean subtreeMatch0(ASTMatcher matcher, Object other) { 121 return matcher.match(this, other); 123 } 124 125 128 void accept0(ASTVisitor visitor) { 129 boolean visitChildren = visitor.visit(this); 130 if (visitChildren) { 131 acceptChildren(visitor, this.expressions); 132 } 133 visitor.endVisit(this); 134 } 135 136 142 public List expressions() { 143 return this.expressions; 144 } 145 146 149 int memSize() { 150 return BASE_NODE_SIZE + 1 * 4; 151 } 152 153 156 int treeSize() { 157 return memSize() + this.expressions.listSize(); 158 } 159 } 160 161 | Popular Tags |