01: package org.kohsuke.rngom.binary.visitor;
02:
03: import org.kohsuke.rngom.binary.Pattern;
04: import org.kohsuke.rngom.nc.NameClass;
05: import org.relaxng.datatype.Datatype;
06:
07: /**
08: * Walks the pattern tree.
09: *
10: * @author
11: * Kohsuke Kawaguchi (kk@kohsuke.org)
12: */
13: public class PatternWalker implements PatternVisitor {
14: public void visitEmpty() {
15: }
16:
17: public void visitNotAllowed() {
18: }
19:
20: public void visitError() {
21: }
22:
23: public void visitGroup(Pattern p1, Pattern p2) {
24: visitBinary(p1, p2);
25: }
26:
27: protected void visitBinary(Pattern p1, Pattern p2) {
28: p1.accept(this );
29: p2.accept(this );
30: }
31:
32: public void visitInterleave(Pattern p1, Pattern p2) {
33: visitBinary(p1, p2);
34: }
35:
36: public void visitChoice(Pattern p1, Pattern p2) {
37: visitBinary(p1, p2);
38: }
39:
40: public void visitOneOrMore(Pattern p) {
41: p.accept(this );
42: }
43:
44: public void visitElement(NameClass nc, Pattern content) {
45: content.accept(this );
46: }
47:
48: public void visitAttribute(NameClass ns, Pattern value) {
49: value.accept(this );
50: }
51:
52: public void visitData(Datatype dt) {
53: }
54:
55: public void visitDataExcept(Datatype dt, Pattern except) {
56: }
57:
58: public void visitValue(Datatype dt, Object obj) {
59: }
60:
61: public void visitText() {
62: }
63:
64: public void visitList(Pattern p) {
65: p.accept(this );
66: }
67:
68: public void visitAfter(Pattern p1, Pattern p2) {
69: }
70: }
|