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 ThrowStatement extends Statement { 28 29 33 public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = 34 new ChildPropertyDescriptor(ThrowStatement.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); 36 41 private static final List PROPERTY_DESCRIPTORS; 42 43 static { 44 List propertyList = new ArrayList (2); 45 createPropertyList(ThrowStatement.class, propertyList); 46 addProperty(EXPRESSION_PROPERTY, propertyList); 47 PROPERTY_DESCRIPTORS = reapPropertyList(propertyList); 48 } 49 50 61 public static List propertyDescriptors(int apiLevel) { 62 return PROPERTY_DESCRIPTORS; 63 } 64 65 69 private Expression expression = null; 70 71 81 ThrowStatement(AST ast) { 82 super(ast); 83 } 84 85 88 final List internalStructuralPropertiesForType(int apiLevel) { 89 return propertyDescriptors(apiLevel); 90 } 91 92 95 final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { 96 if (property == EXPRESSION_PROPERTY) { 97 if (get) { 98 return getExpression(); 99 } else { 100 setExpression((Expression) child); 101 return null; 102 } 103 } 104 return super.internalGetSetChildProperty(property, get, child); 106 } 107 108 111 final int getNodeType0() { 112 return THROW_STATEMENT; 113 } 114 115 118 ASTNode clone0(AST target) { 119 ThrowStatement result = new ThrowStatement(target); 120 result.setSourceRange(this.getStartPosition(), this.getLength()); 121 result.copyLeadingComment(this); 122 result.setExpression((Expression) getExpression().clone(target)); 123 return result; 124 } 125 126 129 final boolean subtreeMatch0(ASTMatcher matcher, Object other) { 130 return matcher.match(this, other); 132 } 133 134 137 void accept0(ASTVisitor visitor) { 138 boolean visitChildren = visitor.visit(this); 139 if (visitChildren) { 140 acceptChild(visitor, getExpression()); 141 } 142 visitor.endVisit(this); 143 } 144 145 150 public Expression getExpression() { 151 if (this.expression == null) { 152 synchronized (this) { 154 if (this.expression == null) { 155 preLazyInit(); 156 this.expression = new SimpleName(this.ast); 157 postLazyInit(this.expression, EXPRESSION_PROPERTY); 158 } 159 } 160 } 161 return this.expression; 162 } 163 164 175 public void setExpression(Expression expression) { 176 if (expression == null) { 177 throw new IllegalArgumentException (); 178 } 179 ASTNode oldChild = this.expression; 180 preReplaceChild(oldChild, expression, EXPRESSION_PROPERTY); 181 this.expression = expression; 182 postReplaceChild(oldChild, expression, EXPRESSION_PROPERTY); 183 } 184 185 188 int memSize() { 189 return super.memSize() + 1 * 4; 190 } 191 192 195 int treeSize() { 196 return 197 memSize() 198 + (this.expression == null ? 0 : getExpression().treeSize()); 199 } 200 } 201 | Popular Tags |