1 package com.thaiopensource.relaxng.impl; 2 3 abstract class ApplyAfterFunction extends AbstractPatternFunction { 4 private final ValidatorPatternBuilder builder; 5 6 ApplyAfterFunction(ValidatorPatternBuilder builder) { 7 this.builder = builder; 8 } 9 10 public Object caseAfter(AfterPattern p) { 11 return builder.makeAfter(p.getOperand1(), apply(p.getOperand2())); 12 } 13 14 public Object caseChoice(ChoicePattern p) { 15 return builder.makeChoice(p.getOperand1().applyForPattern(this), 16 p.getOperand2().applyForPattern(this)); 17 } 18 19 public Object caseNotAllowed(NotAllowedPattern p) { 20 return p; 21 } 22 23 public Object caseOther(Pattern p) { 24 throw new RuntimeException ("apply after botch"); 25 } 26 27 abstract Pattern apply(Pattern p); 28 } 29 | Popular Tags |