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 BreakStatement extends Statement { 28 29 33 public static final ChildPropertyDescriptor LABEL_PROPERTY = 34 new ChildPropertyDescriptor(BreakStatement.class, "label", SimpleName.class, OPTIONAL, NO_CYCLE_RISK); 36 41 private static final List PROPERTY_DESCRIPTORS; 42 43 static { 44 List properyList = new ArrayList (2); 45 createPropertyList(BreakStatement.class, properyList); 46 addProperty(LABEL_PROPERTY, properyList); 47 PROPERTY_DESCRIPTORS = reapPropertyList(properyList); 48 } 49 50 61 public static List propertyDescriptors(int apiLevel) { 62 return PROPERTY_DESCRIPTORS; 63 } 64 65 68 private SimpleName optionalLabel = null; 69 70 79 BreakStatement(AST ast) { 80 super(ast); 81 } 82 83 86 final List internalStructuralPropertiesForType(int apiLevel) { 87 return propertyDescriptors(apiLevel); 88 } 89 90 93 final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { 94 if (property == LABEL_PROPERTY) { 95 if (get) { 96 return getLabel(); 97 } else { 98 setLabel((SimpleName) child); 99 return null; 100 } 101 } 102 return super.internalGetSetChildProperty(property, get, child); 104 } 105 106 109 final int getNodeType0() { 110 return BREAK_STATEMENT; 111 } 112 113 116 ASTNode clone0(AST target) { 117 BreakStatement result = new BreakStatement(target); 118 result.setSourceRange(this.getStartPosition(), this.getLength()); 119 result.copyLeadingComment(this); 120 result.setLabel((SimpleName) ASTNode.copySubtree(target, getLabel())); 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, getLabel()); 139 } 140 visitor.endVisit(this); 141 } 142 143 149 public SimpleName getLabel() { 150 return this.optionalLabel; 151 } 152 153 164 public void setLabel(SimpleName label) { 165 ASTNode oldChild = this.optionalLabel; 166 preReplaceChild(oldChild, label, LABEL_PROPERTY); 167 this.optionalLabel = label; 168 postReplaceChild(oldChild, label, LABEL_PROPERTY); 169 } 170 171 174 int memSize() { 175 return super.memSize() + 1 * 4; 176 } 177 178 181 int treeSize() { 182 return 183 memSize() 184 + (this.optionalLabel == null ? 0 : getLabel().treeSize()); 185 } 186 } 187 188 | Popular Tags |