001    package com.thaiopensource.relaxng.impl;
002    
003    class EmptyPattern extends Pattern {
004      EmptyPattern() {
005        super(true, EMPTY_CONTENT_TYPE, EMPTY_HASH_CODE);
006      }
007      boolean samePattern(Pattern other) {
008        return other instanceof EmptyPattern;
009      }
010      void accept(PatternVisitor visitor) {
011        visitor.visitEmpty();
012      }
013      Object apply(PatternFunction f) {
014        return f.caseEmpty(this);
015      }
016      void checkRestrictions(int context, DuplicateAttributeDetector dad, Alphabet alpha)
017        throws RestrictionViolationException {
018        switch (context) {
019        case DATA_EXCEPT_CONTEXT:
020          throw new RestrictionViolationException("data_except_contains_empty");
021        case START_CONTEXT:
022          throw new RestrictionViolationException("start_contains_empty");
023        }
024      }
025    }