1 package com.thaiopensource.relaxng.impl; 2 3 class TextPattern extends Pattern { 4 TextPattern() { 5 super(true, MIXED_CONTENT_TYPE, TEXT_HASH_CODE); 6 } 7 8 boolean samePattern(Pattern other) { 9 return other instanceof TextPattern; 10 } 11 12 void accept(PatternVisitor visitor) { 13 visitor.visitText(); 14 } 15 16 Object apply(PatternFunction f) { 17 return f.caseText(this); 18 } 19 20 void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) 21 throws RestrictionViolationException { 22 switch (context) { 23 case DATA_EXCEPT_CONTEXT: 24 throw new RestrictionViolationException("data_except_contains_text"); 25 case START_CONTEXT: 26 throw new RestrictionViolationException("start_contains_text"); 27 case LIST_CONTEXT: 28 throw new RestrictionViolationException("list_contains_text"); 29 } 30 } 31 32 } 33 | Popular Tags |