1 57 58 package com.sun.org.apache.xerces.internal.impl.dtd; 59 60 112 public class XMLContentSpec { 113 114 118 122 public static final short CONTENTSPECNODE_LEAF = 0; 123 124 125 public static final short CONTENTSPECNODE_ZERO_OR_ONE = 1; 126 127 128 public static final short CONTENTSPECNODE_ZERO_OR_MORE = 2; 129 130 131 public static final short CONTENTSPECNODE_ONE_OR_MORE = 3; 132 133 134 public static final short CONTENTSPECNODE_CHOICE = 4; 135 136 137 public static final short CONTENTSPECNODE_SEQ = 5; 138 139 149 public static final short CONTENTSPECNODE_ANY = 6; 150 151 158 public static final short CONTENTSPECNODE_ANY_OTHER = 7; 159 160 161 public static final short CONTENTSPECNODE_ANY_LOCAL = 8; 162 163 164 public static final short CONTENTSPECNODE_ANY_LAX = 22; 165 166 public static final short CONTENTSPECNODE_ANY_OTHER_LAX = 23; 167 168 public static final short CONTENTSPECNODE_ANY_LOCAL_LAX = 24; 169 170 171 172 public static final short CONTENTSPECNODE_ANY_SKIP = 38; 173 174 public static final short CONTENTSPECNODE_ANY_OTHER_SKIP = 39; 175 176 public static final short CONTENTSPECNODE_ANY_LOCAL_SKIP = 40; 177 181 191 public short type; 192 193 197 public Object value; 198 199 203 public Object otherValue; 204 205 209 210 public XMLContentSpec() { 211 clear(); 212 } 213 214 215 public XMLContentSpec(short type, Object value, Object otherValue) { 216 setValues(type, value, otherValue); 217 } 218 219 222 public XMLContentSpec(XMLContentSpec contentSpec) { 223 setValues(contentSpec); 224 } 225 226 230 public XMLContentSpec(XMLContentSpec.Provider provider, 231 int contentSpecIndex) { 232 setValues(provider, contentSpecIndex); 233 } 234 235 239 240 public void clear() { 241 type = -1; 242 value = null; 243 otherValue = null; 244 } 245 246 247 public void setValues(short type, Object value, Object otherValue) { 248 this.type = type; 249 this.value = value; 250 this.otherValue = otherValue; 251 } 252 253 254 public void setValues(XMLContentSpec contentSpec) { 255 type = contentSpec.type; 256 value = contentSpec.value; 257 otherValue = contentSpec.otherValue; 258 } 259 260 265 public void setValues(XMLContentSpec.Provider provider, 266 int contentSpecIndex) { 267 if (!provider.getContentSpec(contentSpecIndex, this)) { 268 clear(); 269 } 270 } 271 272 273 277 278 public int hashCode() { 279 return type << 16 | 280 value.hashCode() << 8 | 281 otherValue.hashCode(); 282 } 283 284 285 public boolean equals(Object object) { 286 if (object != null && object instanceof XMLContentSpec) { 287 XMLContentSpec contentSpec = (XMLContentSpec)object; 288 return type == contentSpec.type && 289 value == contentSpec.value && 290 otherValue == contentSpec.otherValue; 291 } 292 return false; 293 } 294 295 296 300 308 public interface Provider { 309 310 314 325 public boolean getContentSpec(int contentSpecIndex, XMLContentSpec contentSpec); 326 327 } 329 } 331 | Popular Tags |