1 16 17 package org.apache.xerces.impl.dtd; 18 19 73 public class XMLContentSpec { 74 75 79 83 public static final short CONTENTSPECNODE_LEAF = 0; 84 85 86 public static final short CONTENTSPECNODE_ZERO_OR_ONE = 1; 87 88 89 public static final short CONTENTSPECNODE_ZERO_OR_MORE = 2; 90 91 92 public static final short CONTENTSPECNODE_ONE_OR_MORE = 3; 93 94 95 public static final short CONTENTSPECNODE_CHOICE = 4; 96 97 98 public static final short CONTENTSPECNODE_SEQ = 5; 99 100 110 public static final short CONTENTSPECNODE_ANY = 6; 111 112 119 public static final short CONTENTSPECNODE_ANY_OTHER = 7; 120 121 122 public static final short CONTENTSPECNODE_ANY_LOCAL = 8; 123 124 125 public static final short CONTENTSPECNODE_ANY_LAX = 22; 126 127 public static final short CONTENTSPECNODE_ANY_OTHER_LAX = 23; 128 129 public static final short CONTENTSPECNODE_ANY_LOCAL_LAX = 24; 130 131 132 133 public static final short CONTENTSPECNODE_ANY_SKIP = 38; 134 135 public static final short CONTENTSPECNODE_ANY_OTHER_SKIP = 39; 136 137 public static final short CONTENTSPECNODE_ANY_LOCAL_SKIP = 40; 138 142 152 public short type; 153 154 158 public Object value; 159 160 164 public Object otherValue; 165 166 170 171 public XMLContentSpec() { 172 clear(); 173 } 174 175 176 public XMLContentSpec(short type, Object value, Object otherValue) { 177 setValues(type, value, otherValue); 178 } 179 180 183 public XMLContentSpec(XMLContentSpec contentSpec) { 184 setValues(contentSpec); 185 } 186 187 191 public XMLContentSpec(XMLContentSpec.Provider provider, 192 int contentSpecIndex) { 193 setValues(provider, contentSpecIndex); 194 } 195 196 200 201 public void clear() { 202 type = -1; 203 value = null; 204 otherValue = null; 205 } 206 207 208 public void setValues(short type, Object value, Object otherValue) { 209 this.type = type; 210 this.value = value; 211 this.otherValue = otherValue; 212 } 213 214 215 public void setValues(XMLContentSpec contentSpec) { 216 type = contentSpec.type; 217 value = contentSpec.value; 218 otherValue = contentSpec.otherValue; 219 } 220 221 226 public void setValues(XMLContentSpec.Provider provider, 227 int contentSpecIndex) { 228 if (!provider.getContentSpec(contentSpecIndex, this)) { 229 clear(); 230 } 231 } 232 233 234 238 239 public int hashCode() { 240 return type << 16 | 241 value.hashCode() << 8 | 242 otherValue.hashCode(); 243 } 244 245 246 public boolean equals(Object object) { 247 if (object != null && object instanceof XMLContentSpec) { 248 XMLContentSpec contentSpec = (XMLContentSpec)object; 249 return type == contentSpec.type && 250 value == contentSpec.value && 251 otherValue == contentSpec.otherValue; 252 } 253 return false; 254 } 255 256 257 261 271 public interface Provider { 272 273 277 288 public boolean getContentSpec(int contentSpecIndex, XMLContentSpec contentSpec); 289 290 } 292 } 294 | Popular Tags |