1 11 12 package org.eclipse.jdt.core.dom; 13 14 import java.util.ArrayList ; 15 import java.util.List ; 16 17 28 public class BooleanLiteral extends Expression { 29 30 34 public static final SimplePropertyDescriptor BOOLEAN_VALUE_PROPERTY = 35 new SimplePropertyDescriptor(BooleanLiteral.class, "booleanValue", boolean.class, MANDATORY); 37 42 private static final List PROPERTY_DESCRIPTORS; 43 44 static { 45 List properyList = new ArrayList (2); 46 createPropertyList(BooleanLiteral.class, properyList); 47 addProperty(BOOLEAN_VALUE_PROPERTY, properyList); 48 PROPERTY_DESCRIPTORS = reapPropertyList(properyList); 49 } 50 51 62 public static List propertyDescriptors(int apiLevel) { 63 return PROPERTY_DESCRIPTORS; 64 } 65 66 69 private boolean value = false; 70 71 79 BooleanLiteral(AST ast) { 80 super(ast); 81 } 82 83 86 final List internalStructuralPropertiesForType(int apiLevel) { 87 return propertyDescriptors(apiLevel); 88 } 89 90 93 final boolean internalGetSetBooleanProperty(SimplePropertyDescriptor property, boolean get, boolean newValue) { 94 if (property == BOOLEAN_VALUE_PROPERTY) { 95 if (get) { 96 return booleanValue(); 97 } else { 98 setBooleanValue(newValue); 99 return false; 100 } 101 } 102 return super.internalGetSetBooleanProperty(property, get, newValue); 104 } 105 106 109 final int getNodeType0() { 110 return BOOLEAN_LITERAL; 111 } 112 113 116 ASTNode clone0(AST target) { 117 BooleanLiteral result = new BooleanLiteral(target); 118 result.setSourceRange(this.getStartPosition(), this.getLength()); 119 result.setBooleanValue(booleanValue()); 120 return result; 121 } 122 123 126 final boolean subtreeMatch0(ASTMatcher matcher, Object other) { 127 return matcher.match(this, other); 129 } 130 131 134 void accept0(ASTVisitor visitor) { 135 visitor.visit(this); 136 visitor.endVisit(this); 137 } 138 139 146 public boolean booleanValue() { 147 return this.value; 148 } 149 150 157 public void setBooleanValue(boolean value) { 158 preValueChange(BOOLEAN_VALUE_PROPERTY); 159 this.value = value; 160 postValueChange(BOOLEAN_VALUE_PROPERTY); 161 } 162 163 166 int memSize() { 167 return BASE_NODE_SIZE + 1 * 4; 168 } 169 170 173 int treeSize() { 174 return memSize(); 175 } 176 } 177 178 | Popular Tags |