1
package com.thaiopensource.relaxng.pattern;
3
import org.xml.sax.Locator;
4
import org.xml.sax.SAXException;
6
class ListPattern extends Pattern {
7
private final Pattern p;
8
private final Locator locator;
10
ListPattern(Pattern p, Locator locator) {
13
combineHashCode(LIST_HASH_CODE, p.hashCode()));
15
this.locator = locator;
18
Pattern expand(SchemaPatternBuilder b) {
19
Pattern ep = p.expand(b);
21
return b.makeList(ep, locator);
26
void checkRecursion(int depth) throws SAXException {
27
p.checkRecursion(depth);
30
boolean samePattern(Pattern other) {
31
return (other instanceof ListPattern
32
&& p == ((ListPattern)other).p);
35
<T> T apply(PatternFunction<T> f) {
36
return f.caseList(this);
39
void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha)
40
throws RestrictionViolationException {
42
case DATA_EXCEPT_CONTEXT:
43
throw new RestrictionViolationException("data_except_contains_list");
45
throw new RestrictionViolationException("start_contains_list");
47
throw new RestrictionViolationException("list_contains_list");
50
p.checkRestrictions(LIST_CONTEXT, dad, null);
52
catch (RestrictionViolationException e) {
53
e.maybeSetLocator(locator);
58
Pattern getOperand() {