KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > parsing > NodeFactory


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.parsing;
23
24 import java.util.List JavaDoc;
25
26 /**
27  * INTERNAL
28  * <p><b>Purpose</b>: This interface specifies methods to create parse trees
29  * and parse tree nodes.
30  * <p><b>Responsibilities</b>:<ul>
31  * <li> Used by the EJBQLParser to create an internal representation of an
32  * EJBQL query.
33  * <li> Abstract from concrete parse tree and parse tree node implementation
34  * classes.
35  * <li> The parse is created in a bottom-up fashion. All methods takes any
36  * child nodes for the parse tree node to be created as arguments. It is the
37  * responsibility of the new<XXX> method to set the parent-child relationship
38  * between the returned node any any of the child nodes passed as arguments.
39  * </ul>
40  */

41 public interface NodeFactory {
42
43     /** Trim specification constants. */
44     public enum TrimSpecification { LEADING, TRAILING, BOTH }
45             
46     // ------------------------------------------
47
// Trees
48
// ------------------------------------------
49

50     /** */
51     public Object JavaDoc newSelectStatement(int line, int column,
52                                      Object JavaDoc select, Object JavaDoc from,
53                                      Object JavaDoc where, Object JavaDoc groupBy,
54                                      Object JavaDoc having, Object JavaDoc orderBy);
55
56     /** */
57     public Object JavaDoc newUpdateStatement(int line, int column,
58                                      Object JavaDoc update, Object JavaDoc set, Object JavaDoc where);
59
60     /** */
61     public Object JavaDoc newDeleteStatement(int line, int column,
62                                      Object JavaDoc delete, Object JavaDoc where);
63
64     // ------------------------------------------
65
// Top level nodes
66
// ------------------------------------------
67

68     /** */
69     public Object JavaDoc newSelectClause(int line, int column,
70                                   boolean distinct, List JavaDoc selectExprs);
71
72     /** */
73     public Object JavaDoc newFromClause(int line, int column, List JavaDoc varDecls);
74
75     /** */
76     public Object JavaDoc newWhereClause(int line, int column, Object JavaDoc condition);
77
78     /** */
79     public Object JavaDoc newGroupByClause(int line, int column, List JavaDoc items);
80
81     /** */
82     public Object JavaDoc newHavingClause(int line, int column, Object JavaDoc arg);
83
84     /** */
85     public Object JavaDoc newOrderByClause(int line, int column, List JavaDoc items);
86
87     /** */
88     public Object JavaDoc newUpdateClause(int line, int column,
89                                   String JavaDoc schema, String JavaDoc variable);
90
91     /** */
92     public Object JavaDoc newDeleteClause(int line, int column,
93                                   String JavaDoc schema, String JavaDoc variable);
94
95     // ------------------------------------------
96
// Variable declaration nodes
97
// ------------------------------------------
98

99     /** */
100     public Object JavaDoc newRangeVariableDecl(int line, int column,
101                                        String JavaDoc schema, String JavaDoc variable);
102
103     /** */
104     public Object JavaDoc newJoinVariableDecl(int line, int column, boolean outer,
105                                       Object JavaDoc path, String JavaDoc variable);
106
107     /** */
108     public Object JavaDoc newFetchJoin(int line, int column, boolean outer, Object JavaDoc path);
109
110     /** */
111     public Object JavaDoc newCollectionMemberVariableDecl(int line, int column,
112                                                   Object JavaDoc path, String JavaDoc variable);
113
114     /** */
115     public Object JavaDoc newVariableDecl(int line, int column,
116                                   Object JavaDoc path, String JavaDoc variable);
117
118     // ------------------------------------------
119
// Identifier and path expression nodes
120
// ------------------------------------------
121

122     /** */
123     public Object JavaDoc newDot(int line, int column, Object JavaDoc left, Object JavaDoc right);
124
125     /** */
126     public Object JavaDoc newVariableAccess(int line, int column, String JavaDoc identifier);
127
128     /** */
129     public Object JavaDoc newAttribute(int line, int column, String JavaDoc identifier);
130
131     // ------------------------------------------
132
// Aggregate nodes
133
// ------------------------------------------
134

135     /** */
136     public Object JavaDoc newAvg(int line, int column, boolean ditinct, Object JavaDoc arg);
137
138     /** */
139     public Object JavaDoc newMax(int line, int column, boolean ditinct, Object JavaDoc arg);
140
141     /** */
142     public Object JavaDoc newMin(int line, int column, boolean ditinct, Object JavaDoc arg);
143
144     /** */
145     public Object JavaDoc newSum(int line, int column, boolean ditinct, Object JavaDoc arg);
146
147     /** */
148     public Object JavaDoc newCount(int line, int column, boolean ditinct, Object JavaDoc arg);
149
150     // ------------------------------------------
151
// Binary expression nodes
152
// ------------------------------------------
153

154     /** */
155     public Object JavaDoc newOr(int line, int column, Object JavaDoc left, Object JavaDoc right);
156     
157     /** */
158     public Object JavaDoc newAnd(int line, int column, Object JavaDoc left, Object JavaDoc right);
159
160     /** */
161     public Object JavaDoc newEquals(int line, int column, Object JavaDoc left, Object JavaDoc right);
162
163     /** */
164     public Object JavaDoc newNotEquals(int line, int column, Object JavaDoc left, Object JavaDoc right);
165
166     /** */
167     public Object JavaDoc newGreaterThan(int line, int column, Object JavaDoc left, Object JavaDoc right);
168
169     /** */
170     public Object JavaDoc newGreaterThanEqual(int line, int column,
171                                       Object JavaDoc left, Object JavaDoc right);
172
173     /** */
174     public Object JavaDoc newLessThan(int line, int column, Object JavaDoc left, Object JavaDoc right);
175
176     /** */
177     public Object JavaDoc newLessThanEqual(int line, int column,
178                                    Object JavaDoc left, Object JavaDoc right);
179     
180     /** */
181     public Object JavaDoc newPlus(int line, int column, Object JavaDoc left, Object JavaDoc right);
182
183     /** */
184     public Object JavaDoc newMinus(int line, int column, Object JavaDoc left, Object JavaDoc right);
185
186     /** */
187     public Object JavaDoc newMultiply(int line, int column, Object JavaDoc left, Object JavaDoc right);
188
189     /** */
190     public Object JavaDoc newDivide(int line, int column, Object JavaDoc left, Object JavaDoc right);
191
192     // ------------------------------------------
193
// Unary expression nodes
194
// ------------------------------------------
195

196     /** */
197     public Object JavaDoc newUnaryPlus(int line, int column, Object JavaDoc arg);
198     
199     /** */
200     public Object JavaDoc newUnaryMinus(int line, int column, Object JavaDoc arg);
201     
202     /** */
203     public Object JavaDoc newNot(int line, int column, Object JavaDoc arg);
204     
205     // ------------------------------------------
206
// Conditional expression nodes
207
// ------------------------------------------
208

209     /** */
210     public Object JavaDoc newBetween(int line, int column, boolean not, Object JavaDoc arg,
211                              Object JavaDoc lower, Object JavaDoc upper);
212
213     /** */
214     public Object JavaDoc newLike(int line, int column, boolean not, Object JavaDoc string,
215                           Object JavaDoc pattern, Object JavaDoc escape) ;
216
217     /** */
218     public Object JavaDoc newEscape(int line, int column, Object JavaDoc arg);
219
220     /** */
221     public Object JavaDoc newIn(int line, int column,
222                         boolean not, Object JavaDoc expr, List JavaDoc items);
223
224     /** */
225     public Object JavaDoc newIsNull(int line, int column, boolean not, Object JavaDoc expr);
226
227     /** */
228     public Object JavaDoc newIsEmpty(int line, int column, boolean not, Object JavaDoc expr) ;
229
230     /** */
231     public Object JavaDoc newMemberOf(int line, int column, boolean not,
232                               Object JavaDoc expr, Object JavaDoc collection);
233
234     // ------------------------------------------
235
// Parameter nodes
236
// ------------------------------------------
237

238     /** */
239     public Object JavaDoc newPositionalParameter(int line, int colimn, String JavaDoc position);
240
241     /** */
242     public Object JavaDoc newNamedParameter(int line, int colimn, String JavaDoc name);
243     
244     // ------------------------------------------
245
// Literal nodes
246
// ------------------------------------------
247

248     /** */
249     public Object JavaDoc newBooleanLiteral(int line, int column, Object JavaDoc value);
250     
251     /** */
252     public Object JavaDoc newIntegerLiteral(int line, int column, Object JavaDoc value);
253     
254     /** */
255     public Object JavaDoc newLongLiteral(int line, int column, Object JavaDoc value);
256     
257     /** */
258     public Object JavaDoc newFloatLiteral(int line, int column, Object JavaDoc value);
259
260     /** */
261     public Object JavaDoc newDoubleLiteral(int line, int column, Object JavaDoc value);
262
263     /** */
264     public Object JavaDoc newStringLiteral(int line, int column, Object JavaDoc value);
265     
266     /** */
267     public Object JavaDoc newNullLiteral(int line, int column);
268     
269     // ------------------------------------------
270
// Objects for functions returning strings
271
// ------------------------------------------
272

273     /** */
274     public Object JavaDoc newConcat(int line, int column, Object JavaDoc left, Object JavaDoc right);
275
276     /** */
277     public Object JavaDoc newSubstring(int line, int column,
278                                Object JavaDoc string, Object JavaDoc start, Object JavaDoc length);
279
280     /** */
281     public Object JavaDoc newTrim(int line, int column, TrimSpecification trimSpec,
282                           Object JavaDoc trimChar, Object JavaDoc string);
283
284     /** */
285     public Object JavaDoc newLower(int line, int column, Object JavaDoc arg);
286
287     /** */
288     public Object JavaDoc newUpper(int line, int column, Object JavaDoc arg);
289
290     // ------------------------------------------
291
// Objects for functions returning numerics
292
// ------------------------------------------
293

294     /** */
295     public Object JavaDoc newLocate(int line, int column,
296                             Object JavaDoc pattern, Object JavaDoc arg, Object JavaDoc startPos);
297
298     /** */
299     public Object JavaDoc newLength(int line, int column, Object JavaDoc arg);
300
301     /** */
302     public Object JavaDoc newAbs(int line, int column, Object JavaDoc arg);
303
304     /** */
305     public Object JavaDoc newSqrt(int line, int column, Object JavaDoc arg);
306
307     /** */
308     public Object JavaDoc newMod(int line, int column, Object JavaDoc left, Object JavaDoc right);
309
310     /** */
311     public Object JavaDoc newSize(int line, int column, Object JavaDoc arg);
312     
313     // ------------------------------------------
314
// Objects for functions returning datetime
315
// ------------------------------------------
316

317     /** */
318     public Object JavaDoc newCurrentDate(int line, int column);
319     
320     /** */
321     public Object JavaDoc newCurrentTime(int line, int column);
322     
323     /** */
324     public Object JavaDoc newCurrentTimestamp(int line, int column);
325     
326     // ------------------------------------------
327
// Subquery nodes
328
// ------------------------------------------
329

330     /** */
331     public Object JavaDoc newSubquery(int line, int column, Object JavaDoc select, Object JavaDoc from, Object JavaDoc where,
332                               Object JavaDoc groupBy, Object JavaDoc having);
333
334     /** */
335     public Object JavaDoc newExists(int line, int column, boolean not, Object JavaDoc subquery);
336
337     /** */
338     public Object JavaDoc newIn(int line, int column, boolean not, Object JavaDoc expr, Object JavaDoc subquery);
339
340     /** */
341     public Object JavaDoc newAll(int line, int column, Object JavaDoc subquery);
342
343     /** */
344     public Object JavaDoc newAny(int line, int column, Object JavaDoc subquery);
345
346     /** */
347     public Object JavaDoc newSome(int line, int column, Object JavaDoc subquery);
348
349     // ------------------------------------------
350
// Miscellaneous nodes
351
// ------------------------------------------
352

353     /** */
354     public Object JavaDoc newAscOrdering(int line, int column, Object JavaDoc arg);
355
356     /** */
357     public Object JavaDoc newDescOrdering(int line, int column, Object JavaDoc arg);
358
359     /** */
360     public Object JavaDoc newConstructor(int line, int colimn,
361                                  String JavaDoc className, List JavaDoc args);
362
363     /** */
364     public Object JavaDoc newSetClause(int line, int colimn, List JavaDoc assignments);
365
366     /** */
367     public Object JavaDoc newSetAssignmentClause(int line, int column,
368                                          Object JavaDoc target, Object JavaDoc value);
369
370 }
371
Popular Tags