KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > runtime > visitor > BaseVisitor


1 package org.apache.velocity.runtime.visitor;
2
3 /*
4  * Copyright 2000-2001,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import java.io.Writer JavaDoc;
20
21 import org.apache.velocity.context.InternalContextAdapter;
22
23 import org.apache.velocity.runtime.parser.node.*;
24
25 /**
26  * This is the base class for all visitors.
27  * For each AST node, this class will provide
28  * a bare-bones method for traversal.
29  *
30  * @author <a HREF="mailto:jvanzyl@apache.org">Jason van Zyl</a>
31  * @author <a HREF="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
32  * @version $Id: BaseVisitor.java,v 1.12.4.1 2004/03/03 23:23:02 geirm Exp $
33  */

34 public abstract class BaseVisitor implements ParserVisitor
35 {
36     /** Context used during traversal */
37     protected InternalContextAdapter context;
38     
39     /** Writer used as the output sink */
40     protected Writer JavaDoc writer;
41     
42     public void setWriter( Writer JavaDoc writer )
43     {
44         this.writer = writer;
45     }
46
47     public void setContext( InternalContextAdapter context)
48     {
49         this.context = context;
50     }
51     
52     public Object JavaDoc visit(SimpleNode node, Object JavaDoc data)
53     {
54         data = node.childrenAccept(this, data);
55         return data;
56     }
57     
58     public Object JavaDoc visit(ASTprocess node, Object JavaDoc data)
59     {
60         data = node.childrenAccept(this, data);
61         return data;
62     }
63
64     public Object JavaDoc visit(ASTExpression node, Object JavaDoc data)
65     {
66         data = node.childrenAccept(this, data);
67         return data;
68     }
69
70     public Object JavaDoc visit(ASTAssignment node, Object JavaDoc data)
71     {
72         data = node.childrenAccept(this, data);
73         return data;
74     }
75     
76     public Object JavaDoc visit(ASTOrNode node, Object JavaDoc data)
77     {
78         data = node.childrenAccept(this, data);
79         return data;
80     }
81     
82     public Object JavaDoc visit(ASTAndNode node, Object JavaDoc data)
83     {
84         data = node.childrenAccept(this, data);
85         return data;
86     }
87
88     public Object JavaDoc visit(ASTEQNode node, Object JavaDoc data)
89     {
90         data = node.childrenAccept(this, data);
91         return data;
92     }
93     
94     public Object JavaDoc visit(ASTNENode node, Object JavaDoc data)
95     {
96         data = node.childrenAccept(this, data);
97         return data;
98     }
99
100     public Object JavaDoc visit(ASTLTNode node, Object JavaDoc data)
101     {
102         data = node.childrenAccept(this, data);
103         return data;
104     }
105
106     public Object JavaDoc visit(ASTGTNode node, Object JavaDoc data)
107     {
108         data = node.childrenAccept(this, data);
109         return data;
110     }
111     
112     public Object JavaDoc visit(ASTLENode node, Object JavaDoc data)
113     {
114         data = node.childrenAccept(this, data);
115         return data;
116     }
117     
118     public Object JavaDoc visit(ASTGENode node, Object JavaDoc data)
119     {
120         data = node.childrenAccept(this, data);
121         return data;
122     }
123     
124     public Object JavaDoc visit(ASTAddNode node, Object JavaDoc data)
125     {
126         data = node.childrenAccept(this, data);
127         return data;
128     }
129     
130     public Object JavaDoc visit(ASTSubtractNode node, Object JavaDoc data)
131     {
132         data = node.childrenAccept(this, data);
133         return data;
134     }
135     
136     public Object JavaDoc visit(ASTMulNode node, Object JavaDoc data)
137     {
138         data = node.childrenAccept(this, data);
139         return data;
140     }
141     
142     public Object JavaDoc visit(ASTDivNode node, Object JavaDoc data)
143     {
144         data = node.childrenAccept(this, data);
145         return data;
146     }
147     
148     public Object JavaDoc visit(ASTModNode node, Object JavaDoc data)
149     {
150         data = node.childrenAccept(this, data);
151         return data;
152     }
153     
154     public Object JavaDoc visit(ASTNotNode node, Object JavaDoc data)
155     {
156         data = node.childrenAccept(this, data);
157         return data;
158     }
159     
160     public Object JavaDoc visit(ASTNumberLiteral node, Object JavaDoc data)
161     {
162         data = node.childrenAccept(this, data);
163         return data;
164     }
165     
166     public Object JavaDoc visit(ASTStringLiteral node, Object JavaDoc data)
167     {
168         data = node.childrenAccept(this, data);
169         return data;
170     }
171     
172     public Object JavaDoc visit(ASTIdentifier node, Object JavaDoc data)
173     {
174         data = node.childrenAccept(this, data);
175         return data;
176     }
177     
178     public Object JavaDoc visit(ASTMethod node, Object JavaDoc data)
179     {
180         data = node.childrenAccept(this, data);
181         return data;
182     }
183     
184     public Object JavaDoc visit(ASTReference node, Object JavaDoc data)
185     {
186         data = node.childrenAccept(this, data);
187         return data;
188     }
189     
190     public Object JavaDoc visit(ASTTrue node, Object JavaDoc data)
191     {
192         data = node.childrenAccept(this, data);
193         return data;
194     }
195     
196     public Object JavaDoc visit(ASTFalse node, Object JavaDoc data)
197     {
198         data = node.childrenAccept(this, data);
199         return data;
200     }
201     
202     public Object JavaDoc visit(ASTBlock node, Object JavaDoc data)
203     {
204         data = node.childrenAccept(this, data);
205         return data;
206     }
207     
208     public Object JavaDoc visit(ASTText node, Object JavaDoc data)
209     {
210         data = node.childrenAccept(this, data);
211         return data;
212     }
213     
214     public Object JavaDoc visit(ASTIfStatement node, Object JavaDoc data)
215     {
216         data = node.childrenAccept(this, data);
217         return data;
218     }
219     
220     public Object JavaDoc visit(ASTElseStatement node, Object JavaDoc data)
221     {
222         data = node.childrenAccept(this, data);
223         return data;
224     }
225     
226     public Object JavaDoc visit(ASTElseIfStatement node, Object JavaDoc data)
227     {
228         data = node.childrenAccept(this, data);
229         return data;
230     }
231     
232     public Object JavaDoc visit(ASTComment node, Object JavaDoc data)
233     {
234         data = node.childrenAccept(this, data);
235         return data;
236     }
237
238     public Object JavaDoc visit(ASTObjectArray node, Object JavaDoc data)
239     {
240         data = node.childrenAccept(this, data);
241         return data;
242     }
243
244     public Object JavaDoc visit(ASTWord node, Object JavaDoc data)
245     {
246         data = node.childrenAccept(this, data);
247         return data;
248     }
249     
250     public Object JavaDoc visit(ASTSetDirective node, Object JavaDoc data)
251     {
252         data = node.childrenAccept(this, data);
253         return data;
254     }
255     
256     public Object JavaDoc visit(ASTDirective node, Object JavaDoc data)
257     {
258         data = node.childrenAccept(this, data);
259         return data;
260     }
261 }
262
Popular Tags