1
2
3
4
5 package com.randomnoun.common.jexl.visitor;
6 import com.randomnoun.common.jexl.ast.*;
7 import java.util.*;
8
9
10
11
12
13 public class GJDepthFirst<R,A> implements GJVisitor<R,A> {
14
15
16
17 public R visit(NodeList n, A argu) {
18 R _ret=null;
19 int _count=0;
20 for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
21 e.nextElement().accept(this,argu);
22 _count++;
23 }
24 return _ret;
25 }
26
27 public R visit(NodeListOptional n, A argu) {
28 if ( n.present() ) {
29 R _ret=null;
30 int _count=0;
31 for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
32 e.nextElement().accept(this,argu);
33 _count++;
34 }
35 return _ret;
36 }
37 else
38 return null;
39 }
40
41 public R visit(NodeOptional n, A argu) {
42 if ( n.present() )
43 return n.node.accept(this,argu);
44 else
45 return null;
46 }
47
48 public R visit(NodeSequence n, A argu) {
49 R _ret=null;
50 int _count=0;
51 for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
52 e.nextElement().accept(this,argu);
53 _count++;
54 }
55 return _ret;
56 }
57
58 public R visit(NodeToken n, A argu) { return null; }
59
60
61
62
63
64
65
66
67
68
69
70 public R visit(TopLevelExpression n, A argu) {
71 R _ret=null;
72 n.expression.accept(this, argu);
73 n.nodeToken.accept(this, argu);
74 return _ret;
75 }
76
77
78
79
80
81
82
83 public R visit(Expression n, A argu) {
84 R _ret=null;
85 n.conditionalAndExpression.accept(this, argu);
86 n.nodeListOptional.accept(this, argu);
87 return _ret;
88 }
89
90
91
92
93
94
95
96 public R visit(ConditionalAndExpression n, A argu) {
97 R _ret=null;
98 n.equalityExpression.accept(this, argu);
99 n.nodeListOptional.accept(this, argu);
100 return _ret;
101 }
102
103
104
105
106
107
108
109 public R visit(EqualityExpression n, A argu) {
110 R _ret=null;
111 n.relationalExpression.accept(this, argu);
112 n.nodeListOptional.accept(this, argu);
113 return _ret;
114 }
115
116
117
118
119
120
121
122 public R visit(RelationalExpression n, A argu) {
123 R _ret=null;
124 n.additiveExpression.accept(this, argu);
125 n.nodeListOptional.accept(this, argu);
126 return _ret;
127 }
128
129
130
131
132
133
134
135 public R visit(AdditiveExpression n, A argu) {
136 R _ret=null;
137 n.multiplicativeExpression.accept(this, argu);
138 n.nodeListOptional.accept(this, argu);
139 return _ret;
140 }
141
142
143
144
145
146
147
148 public R visit(MultiplicativeExpression n, A argu) {
149 R _ret=null;
150 n.unaryExpression.accept(this, argu);
151 n.nodeListOptional.accept(this, argu);
152 return _ret;
153 }
154
155
156
157
158
159
160
161 public R visit(UnaryExpression n, A argu) {
162 R _ret=null;
163 n.nodeChoice.accept(this, argu);
164 return _ret;
165 }
166
167
168
169
170
171
172
173
174
175 public R visit(PrimaryExpression n, A argu) {
176 R _ret=null;
177 n.nodeChoice.accept(this, argu);
178 return _ret;
179 }
180
181
182
183
184
185
186
187 public R visit(Name n, A argu) {
188 R _ret=null;
189 n.nodeToken.accept(this, argu);
190 n.nodeListOptional.accept(this, argu);
191 return _ret;
192 }
193
194
195
196
197
198
199
200 public R visit(FunctionCall n, A argu) {
201 R _ret=null;
202 n.nodeToken.accept(this, argu);
203 n.arguments.accept(this, argu);
204 return _ret;
205 }
206
207
208
209
210
211
212
213
214 public R visit(Arguments n, A argu) {
215 R _ret=null;
216 n.nodeToken.accept(this, argu);
217 n.nodeOptional.accept(this, argu);
218 n.nodeToken1.accept(this, argu);
219 return _ret;
220 }
221
222
223
224
225
226
227
228 public R visit(ArgumentList n, A argu) {
229 R _ret=null;
230 n.expression.accept(this, argu);
231 n.nodeListOptional.accept(this, argu);
232 return _ret;
233 }
234
235
236
237
238
239
240
241
242
243
244
245 public R visit(Literal n, A argu) {
246 R _ret=null;
247 n.nodeChoice.accept(this, argu);
248 return _ret;
249 }
250
251
252
253
254
255
256
257 public R visit(BooleanLiteral n, A argu) {
258 R _ret=null;
259 n.nodeChoice.accept(this, argu);
260 return _ret;
261 }
262
263
264
265
266
267
268 public R visit(NullLiteral n, A argu) {
269 R _ret=null;
270 n.nodeToken.accept(this, argu);
271 return _ret;
272 }
273
274 }