KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > utils > parser > vectorForBestAndNonBest


1 package com.daffodilwoods.daffodildb.utils.parser;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.HashMap JavaDoc;
5 import java.util.List JavaDoc;
6 import java.util.*;
7
8 public class vectorForBestAndNonBest {
9
10    public vectorForBestAndNonBest() {
11    }
12
13    public static List JavaDoc getRulesWithComparableWithHashMap(){
14       ArrayList JavaDoc vector = new ArrayList JavaDoc();
15       vector.add("position expression");
16       vector.add("extract expression");
17       vector.add("length expression");
18       vector.add("cardinality expression");
19       vector.add("absolute value expression");
20       vector.add("modulus function");
21       vector.add("sine function");
22       vector.add("power function");
23       vector.add("round function");
24       vector.add("sqrt function");
25       vector.add("truncate function");
26       vector.add("floor function");
27       vector.add("ceiling function");
28       vector.add("log function");
29       vector.add("exp function");
30       vector.add("cos function");
31       vector.add("tan function");
32       vector.add("cot function");
33       vector.add("acos function");
34       vector.add("asin function");
35       vector.add("atan function");
36       vector.add("degrees function");
37       vector.add("radians function");
38       vector.add("pi function");
39       vector.add("atan2 function");
40       vector.add("current time value function");
41       vector.add("current timestamp function");
42       vector.add("current local time value function");
43       vector.add("current local timestamp value function");
44       vector.add("dayname function");
45       vector.add("dayofmonth function");
46       vector.add("dayofweek function");
47       vector.add("dayofyear function");
48       vector.add("week function");
49       vector.add("month function");
50       vector.add("monthname function");
51       vector.add("hour function");
52       vector.add("minute function");
53       vector.add("second function");
54       vector.add("timestampadd function");
55       vector.add("timestampdiff function");
56       vector.add("character substring function");
57       vector.add("regular substring function");
58       vector.add("fold");
59       vector.add("form_of_use conversion");
60       vector.add("character translation");
61       vector.add("trim function");
62       vector.add("character overlay function");
63       vector.add("specific type method");
64       vector.add("ascii value method");
65       vector.add("right function");
66       vector.add("left function");
67       vector.add("space function");
68       vector.add("tochar function");
69       vector.add("replace function");
70       vector.add("repeat function");
71       return vector;
72    }
73
74    public static HashMap JavaDoc getRulesWithBest(){
75       HashMap JavaDoc hashMap = new HashMap JavaDoc();
76       hashMap.put("row value expression",null);
77       hashMap.put("assignment source",null);
78       hashMap.put("data typedomain name",null);
79       hashMap.put("contextually typed row value constructor element",null);
80       hashMap.put("repetitive column",null);
81       hashMap.put("xyz",null);
82       hashMap.put("column renderer",null);
83       hashMap.put("value expression",null);
84       hashMap.put("value expression primary",null);
85       hashMap.put("value expression without row value constructor",null);
86       hashMap.put("value expression without boolean",null);
87       hashMap.put("value expression without row value constructor without boolean",null);
88       hashMap.put("row value expression without boolean",null);
89       hashMap.put("boolean primary",null);
90       hashMap.put("grouping specification",null);
91       hashMap.put("update source",null);
92       hashMap.put("character string type",null);
93       hashMap.put("national character string type",null);
94       hashMap.put("binary large object string type",null);
95       hashMap.put("data type",null);
96       hashMap.put("bit string type",null);
97       hashMap.put("predefined type",null);
98       hashMap.put("action",null);
99       hashMap.put("insert columns and source",null);
100       hashMap.put("unique constraint definition",null);
101       hashMap.put("STRANSFORM-455705780STRANSFORMS-1241977209",null);
102       hashMap.put("interval qualifier",null);
103       hashMap.put("select sublist",null);
104       hashMap.put("table reference",null);
105       hashMap.put("query expression body",null);
106       hashMap.put("grouping set",null);
107       hashMap.put("return value",null);
108       hashMap.put("string function parameters",null);
109       hashMap.put("SQL argument",null);
110
111
112
113       return hashMap;
114    }
115
116    public static List JavaDoc getRulesToBeIncludedInNonComparableRules(){
117       ArrayList JavaDoc vector = new ArrayList JavaDoc();
118       vector.add("searched case");
119       vector.add("SQL procedure statement");
120       vector.add("drop view statement");
121       vector.add("set transaction statement");
122       vector.add("assignment statement");
123       vector.add("dummy rule");
124       vector.add("SLONG2342524SVARBINARY-1783518776Optparen large object length");
125       vector.add("SNEW77184OptSRESERVEDWORD1206543922OptSRESERVEDWORD1206543922new values correlation name");
126       vector.add("SOLD78343OptSRESERVEDWORD1206543922OptSRESERVEDWORD1206543922old values correlation name");
127       vector.add("SCHAR2067286Optparen length");
128       vector.add("SCHARACTER55823113Optparen length");
129       vector.add("SBIT65773Optparen length");
130
131       vector.add("SNATIONAL-1466853966SCHAR2067286OptSleft paren653880241lengthSright paren-1874859514");
132       vector.add("SNATIONAL-1466853966SCHARACTER55823113OptSleft paren653880241lengthSright paren-1874859514");
133       vector.add("SNCHAR74101924OptSleft paren653880241lengthSright paren-1874859514");
134
135       vector.add("SSELECT-1852692228Sleft paren653880241privilege method listSright paren-1874859514");
136       vector.add("alter routine statement");
137       vector.add("drop routine statement");
138       vector.add("SQL-invoked routine");
139       vector.add("drop column definition");
140       vector.add("schema function");
141       vector.add("transform definition");
142       vector.add("drop transform statement");
143       vector.add("add original method specification");
144       vector.add("add overriding method specification");
145       vector.add("drop method specification");
146       vector.add("delete statement: positioned");
147       vector.add("update statement: positioned");
148       vector.add("delete statement: searched");
149       vector.add("update statement: searched");
150       vector.add("set transaction statement");
151       vector.add("revoke privilege statement");
152       vector.add("revoke role statement");
153       return vector;
154    }
155
156    public static List JavaDoc getRulesWithHashMapToBeIncludedAsNonHashMap(){
157       ArrayList JavaDoc vector = new ArrayList JavaDoc();
158       vector.add("role definition");
159       vector.add("user-defined type definition");
160       vector.add("trigger definition");
161       vector.add("assertion definition");
162       vector.add("translation definition");
163       vector.add("collation definition");
164       vector.add("character set definition");
165       vector.add("domain definition");
166       return vector;
167    }
168
169
170
171
172    public static HashSet mapOfSystemDefienedFunctions = new HashSet();
173
174    static{
175      /* ABS ACOS ASCII ASIN ATAN ATAN2
176       CEILING CHAR CONCAT COS COT COUNT CURDATE CURTIME CURTIMESTAMP
177       DATABASE DATE DAYOFMONTH DAYOFWEEK DAYOFYEAR DAYNAME DECODE DEGREES DIFFERENCE DUMP
178       EQUALSCASESENSITIVE EXP FLOOR HOUR IFNULL INITCAP INSERT LCASE LEFT LENGTH
179       LTRIM LOCATE LOG MINUTE MOD MONTH MONTHNAME NULLIF PI POWER
180       RADIANS RAND REPEAT REPLACE RIGHT ROUND ROWNUM RTRIM
181       SQRT SECOND SIN SIGN SOUNDEX SPACE STRING SUBSTRING SYS_CONTEXT
182        USER UCASE WEEK YEAR */

183     String JavaDoc[] systemDefinedFunctions = {"ABS","MOD","POWER","SQRT","ROUND"
184         ,"TRUNCATE","FLOOR","CIELING","LOG","EXP","RAND","SIN","COS","TAN","COT","ACOS","ASIN",
185         "ATAN","ATAN2","PI","DEGREES","RADIANS","TRUNCATE","SIGN","ASCII","CHAR","CONCAT","DIFFERENCE",
186         "EQUALSCASESENSITIVE","INSERT","LCASE","LEFT","LENGTH","LOCATE","LTRIM","REPEAT","REPLACE",
187         "RIGHT","SOUNDEX","SPACE","SUBSTRING","UCASE","DATE","DAYNAME","DAYOFMONTH","DAYOFWEAK","DAYOFYEAR",
188         "HOUR","MINUTE","MONTH","MONTHNAME","SECOND","TIME","TIMESTAMPADD","TIMESTAMPDIFF",
189         "YEAR","TRIM","TRUNC","DECODE","DUMP","INITCAP","TIMESTAMP","NULLIF","IFNULL",
190         "WEEK","RTRIM","DAYOFWEEK","CEILING","MAX","MIN","AVG","SUM","COUNT","STRING",
191         "CURDATE","CURTIME","CURTIMESTAMP","DATABASE","ROWNUM","SYS_CONTEXT","USER","LOWER"};
192     mapOfSystemDefienedFunctions.addAll(Arrays.asList(systemDefinedFunctions));
193    }
194
195    public static boolean checkForSystemDefienedFunctions(String JavaDoc functionName){
196      return mapOfSystemDefienedFunctions.contains(functionName.toUpperCase() ) ;
197    }
198 }
199
200
Popular Tags