KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > relaxng > impl > ApplyAfterFunction


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 JavaDoc caseAfter(AfterPattern p) {
11     return builder.makeAfter(p.getOperand1(), apply(p.getOperand2()));
12   }
13
14   public Object JavaDoc caseChoice(ChoicePattern p) {
15     return builder.makeChoice(p.getOperand1().applyForPattern(this),
16                   p.getOperand2().applyForPattern(this));
17   }
18
19   public Object JavaDoc caseNotAllowed(NotAllowedPattern p) {
20     return p;
21   }
22
23   public Object JavaDoc caseOther(Pattern p) {
24     throw new RuntimeException JavaDoc("apply after botch");
25   }
26
27   abstract Pattern apply(Pattern p);
28 }
29
Popular Tags