001 package com.thaiopensource.relaxng.impl; 002 003 class TextPattern extends Pattern { 004 TextPattern() { 005 super(true, MIXED_CONTENT_TYPE, TEXT_HASH_CODE); 006 } 007 008 boolean samePattern(Pattern other) { 009 return other instanceof TextPattern; 010 } 011 012 void accept(PatternVisitor visitor) { 013 visitor.visitText(); 014 } 015 016 Object apply(PatternFunction f) { 017 return f.caseText(this); 018 } 019 020 void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha) 021 throws RestrictionViolationException { 022 switch (context) { 023 case DATA_EXCEPT_CONTEXT: 024 throw new RestrictionViolationException("data_except_contains_text"); 025 case START_CONTEXT: 026 throw new RestrictionViolationException("start_contains_text"); 027 case LIST_CONTEXT: 028 throw new RestrictionViolationException("list_contains_text"); 029 } 030 } 031 032 }