svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.api / src / main / java / org / gvsig / expressionevaluator / ExpressionBuilder.java @ 44006
History | View | Annotate | Download (11 KB)
1 | 44006 | jjdelcerro | package org.gvsig.expressionevaluator; |
---|---|---|---|
2 | 43020 | jjdelcerro | |
3 | import java.util.List; |
||
4 | import org.cresques.cts.IProjection; |
||
5 | import org.gvsig.fmap.geom.Geometry; |
||
6 | 43034 | jjdelcerro | import org.gvsig.fmap.geom.primitive.Envelope; |
7 | 43020 | jjdelcerro | |
8 | public interface ExpressionBuilder { |
||
9 | |||
10 | public enum GeometrySupportType { |
||
11 | WKT, |
||
12 | WKB, |
||
13 | 43358 | jjdelcerro | EWKB, |
14 | NATIVE |
||
15 | 43020 | jjdelcerro | } |
16 | |||
17 | public enum ParameterType { |
||
18 | Variable, |
||
19 | Constant, |
||
20 | Geometry |
||
21 | } |
||
22 | |||
23 | public interface VisitorFilter { |
||
24 | boolean accept(Visitable visitable);
|
||
25 | } |
||
26 | |||
27 | public interface Visitor { |
||
28 | public void visit(Visitable value); |
||
29 | } |
||
30 | |||
31 | public interface Visitable { |
||
32 | public void accept(Visitor visitor, VisitorFilter filter); |
||
33 | } |
||
34 | |||
35 | public interface Config { |
||
36 | public final static String has_spatial_functions = "has_spatial_functions"; |
||
37 | 43355 | jjdelcerro | public final static String support_schemas = "support_schemas"; |
38 | 43020 | jjdelcerro | public final static String quote_for_identifiers = "quote_for_identifiers"; |
39 | public final static String quote_for_strings = "quote_for_strings"; |
||
40 | public final static String geometry_type_support = "geometry_type_support"; |
||
41 | public final static String constant_true = "constant_true"; |
||
42 | public final static String constant_false = "constant_false"; |
||
43 | public final static String group = "group"; |
||
44 | public final static String attribute_crs = "crs"; |
||
45 | |||
46 | public final static String ST_SRID = "ST_SRID"; |
||
47 | public final static String ST_AsText = "ST_AsText"; |
||
48 | public final static String ST_AsBinary = "ST_AsBinary"; |
||
49 | public final static String ST_AsEWKB = "ST_AsEWKB"; |
||
50 | public final static String ST_Contains = "ST_Contains"; |
||
51 | public final static String ST_Crosses = "ST_Crosses"; |
||
52 | public final static String ST_Disjoint = "ST_Disjoint"; |
||
53 | 43034 | jjdelcerro | public final static String ST_Equals = "ST_Equals"; |
54 | 43020 | jjdelcerro | public final static String ST_IsClosed = "ST_IsClosed"; |
55 | public final static String ST_Overlaps = "ST_Overlaps"; |
||
56 | public final static String ST_Touches = "ST_Touches"; |
||
57 | public final static String ST_Within = "ST_Within"; |
||
58 | public final static String ST_Intersects = "ST_Intersects"; |
||
59 | public final static String ST_Envelope = "ST_Envelope"; |
||
60 | public final static String ST_GeomFromText = "ST_GeomFromText"; |
||
61 | public final static String ST_GeomFromWKB = "ST_GeomFromWKB"; |
||
62 | public final static String ST_GeomFromEWKB = "ST_GeomFromEWKB"; |
||
63 | 43355 | jjdelcerro | public final static String ST_Simplify = "ST_Simplify"; |
64 | 43020 | jjdelcerro | public final static String lcase = "lcase"; |
65 | public final static String ucase = "ucase"; |
||
66 | public final static String isNull = "isNull"; |
||
67 | public final static String notIsNull = "notIsNull"; |
||
68 | public final static String operator_not = "operator_not"; |
||
69 | |||
70 | public final static String operator_AND = "operator_AND"; |
||
71 | public final static String operator_OR = "operator_OR"; |
||
72 | public final static String operator_EQ = "operator_EQ"; |
||
73 | public final static String operator_NE = "operator_NE"; |
||
74 | public final static String operator_GT = "operator_GT"; |
||
75 | public final static String operator_GE = "operator_GE"; |
||
76 | public final static String operator_LT = "operator_LT"; |
||
77 | public final static String operator_LE = "operator_LE"; |
||
78 | public final static String operator_LIKE = "operator_LIKE"; |
||
79 | public final static String operator_ILIKE = "operator_ILIKE"; |
||
80 | |||
81 | public final static String operator_add = "operator_add"; |
||
82 | public final static String operator_subst = "operator_subst"; |
||
83 | public final static String operator_mult = "operator_mult"; |
||
84 | public final static String operator_div = "operator_div"; |
||
85 | public final static String operator_concat = "operator_concat"; |
||
86 | |||
87 | |||
88 | public GeometrySupportType getGeometryTypeSupport();
|
||
89 | public boolean has_spatial_functions(); |
||
90 | public boolean has_functionality(String functionality); |
||
91 | public void remove_functionality(String functionality); |
||
92 | |||
93 | public boolean getBoolean(String name); |
||
94 | public String getString(String name); |
||
95 | public Object get(String name); |
||
96 | public void set(String name, Object value); |
||
97 | } |
||
98 | |||
99 | public interface Value extends Visitable { |
||
100 | |||
101 | } |
||
102 | |||
103 | public interface Group extends Value { |
||
104 | public Value getValue();
|
||
105 | } |
||
106 | |||
107 | public interface Constant extends Value { |
||
108 | public Object getValue(); |
||
109 | } |
||
110 | |||
111 | public interface Custom extends Value { |
||
112 | public Object getValue(); |
||
113 | public Custom add(Variable variable);
|
||
114 | public Custom add(Parameter parameter);
|
||
115 | } |
||
116 | |||
117 | public interface GeometryValue extends Value { |
||
118 | public Geometry getGeometry();
|
||
119 | public IProjection getSRS();
|
||
120 | } |
||
121 | |||
122 | 43739 | jjdelcerro | public interface ColumnDescriptor { |
123 | public String getName(); |
||
124 | public int getType(); |
||
125 | public int getSize(); |
||
126 | public int getPrecision(); |
||
127 | public boolean isPrimaryKey(); |
||
128 | public boolean isIndexed(); |
||
129 | public boolean isAutomatic(); |
||
130 | boolean allowNulls();
|
||
131 | public Object getDefaultValue(); |
||
132 | public int getGeometryType(); |
||
133 | public int getGeometrySubtype(); |
||
134 | public Object getGeometrySRSId(); |
||
135 | public boolean isGeometry(); |
||
136 | |||
137 | public void setName(String name); |
||
138 | public void setType(int type); |
||
139 | public void setSize(int size); |
||
140 | public void setPrecision(int precision); |
||
141 | public void setIsPrimaryKey(boolean isPk); |
||
142 | public void setIsAutomatic(boolean isAutomatic); |
||
143 | public void setAllowNulls(boolean allowNulls); |
||
144 | public void setDefaultValue(Object defaultValue); |
||
145 | public void setGeometryType(int geom_type); |
||
146 | public void setGeometrySubtype(int geom_subtype); |
||
147 | public void setGeometrySRSId(Object geom_srsid); |
||
148 | } |
||
149 | |||
150 | 43020 | jjdelcerro | public interface Variable extends Value, Comparable<Variable> { |
151 | public String getName(); |
||
152 | 43739 | jjdelcerro | public ColumnDescriptor getDescriptor();
|
153 | 43020 | jjdelcerro | } |
154 | |||
155 | public interface Parameter extends Value { |
||
156 | public Parameter as_constant();
|
||
157 | public Parameter as_variable();
|
||
158 | 43093 | jjdelcerro | public Parameter as_geometry_variable();
|
159 | 43020 | jjdelcerro | public Parameter srs(Value srs);
|
160 | public Parameter srs(IProjection srs);
|
||
161 | public String getName(); |
||
162 | public Object getValue(); |
||
163 | 43093 | jjdelcerro | public Parameter value(Object value); |
164 | public Parameter name(String value); |
||
165 | 43020 | jjdelcerro | public ParameterType getType();
|
166 | public Value getSRS();
|
||
167 | public boolean is_constant(); |
||
168 | public boolean is_variable(); |
||
169 | public boolean is_geometry_variable(); |
||
170 | } |
||
171 | 43093 | jjdelcerro | |
172 | public interface Parameters extends List<Parameter> { |
||
173 | public Parameter get(String name); |
||
174 | } |
||
175 | 43020 | jjdelcerro | |
176 | public interface Function extends Value { |
||
177 | public String getName(); |
||
178 | public List<Value> parameters(); |
||
179 | public Function parameter(Value parameter);
|
||
180 | } |
||
181 | |||
182 | public interface BinaryOperator extends Value { |
||
183 | public String getName(); |
||
184 | public Value getLeft();
|
||
185 | public Value getRight();
|
||
186 | public BinaryOperator setLeft(Value operand);
|
||
187 | public BinaryOperator setRight(Value operand);
|
||
188 | } |
||
189 | |||
190 | public void accept(Visitor visitor, VisitorFilter filter); |
||
191 | |||
192 | public List<Variable> getVariables(); |
||
193 | |||
194 | 43093 | jjdelcerro | public Parameters getParameters();
|
195 | 43020 | jjdelcerro | |
196 | public boolean has_spatial_functions(); |
||
197 | |||
198 | public GeometrySupportType geometry_support_type();
|
||
199 | |||
200 | public String identifier(String name); |
||
201 | |||
202 | public String bytearray(byte[] data); |
||
203 | 44006 | jjdelcerro | |
204 | public String bytearray_hex(byte[] data); |
||
205 | 43020 | jjdelcerro | |
206 | 44006 | jjdelcerro | public String bytearray_0x(byte[] data); |
207 | |||
208 | public String bytearray_x(byte[] data); |
||
209 | |||
210 | 43020 | jjdelcerro | public String string(String s); |
211 | |||
212 | 43687 | jjdelcerro | public Object getSRSId(IProjection projection); |
213 | 43020 | jjdelcerro | |
214 | public Config getConfig();
|
||
215 | |||
216 | public Value getValue();
|
||
217 | |||
218 | public ExpressionBuilder setValue(Value value);
|
||
219 | |||
220 | public Variable variable(String name); |
||
221 | |||
222 | public Variable column(String name); // Alias for variable(name) |
||
223 | |||
224 | 43093 | jjdelcerro | public Parameter parameter(String name); |
225 | 43020 | jjdelcerro | |
226 | 43093 | jjdelcerro | public Parameter parameter();
|
227 | |||
228 | 43020 | jjdelcerro | public Constant constant(Object value); |
229 | |||
230 | public Group group(Value group); |
||
231 | |||
232 | public GeometryValue geometry(Geometry geom, IProjection projection);
|
||
233 | |||
234 | 44006 | jjdelcerro | public GeometryValue geometry(Geometry geom);
|
235 | |||
236 | 43034 | jjdelcerro | public GeometryValue envelope(Envelope envelope, IProjection projection);
|
237 | |||
238 | 44006 | jjdelcerro | public GeometryValue envelope(Envelope envelope);
|
239 | |||
240 | 43020 | jjdelcerro | public Custom custom(Object value); |
241 | |||
242 | public Constant srs(IProjection projection);
|
||
243 | |||
244 | public Function getAsGeometry(Value value);
|
||
245 | |||
246 | |||
247 | public Function not(Value value);
|
||
248 | |||
249 | public Function notIsNull(Value value);
|
||
250 | |||
251 | public Function isNull(Value value);
|
||
252 | |||
253 | public Function ST_SRID(Value geom);
|
||
254 | |||
255 | public Function ST_AsText(Value geom);
|
||
256 | |||
257 | public Function ST_AsBinary(Value geom);
|
||
258 | |||
259 | public Function ST_AsEWKB(Value geom);
|
||
260 | |||
261 | public Function ST_Envelope(Value geom);
|
||
262 | |||
263 | public Function ST_GeomFromText(Value geom, Value crs);
|
||
264 | |||
265 | public Function ST_GeomFromWKB(Value geom, Value crs);
|
||
266 | |||
267 | public Function ST_GeomFromEWKB(Value geom, Value crs);
|
||
268 | |||
269 | 43355 | jjdelcerro | public Function ST_Simplify(Value geom, Value tolerance);
|
270 | |||
271 | 43034 | jjdelcerro | public Function ST_Equals(Value geom1, Value geom2);
|
272 | |||
273 | 43020 | jjdelcerro | public Function ST_Intersects(Value geom1, Value geom2);
|
274 | |||
275 | public Function ST_Contains(Value geom1, Value geom2);
|
||
276 | |||
277 | 43034 | jjdelcerro | public Function ST_Disjoint(Value geom1, Value geom2);
|
278 | |||
279 | 43020 | jjdelcerro | public Function ST_Crosses(Value geom1, Value geom2);
|
280 | |||
281 | public Function ST_IsClosed(Value geom1);
|
||
282 | |||
283 | public Function ST_Overlaps(Value geom1, Value geom2);
|
||
284 | |||
285 | public Function ST_Touches(Value geom1, Value geom2);
|
||
286 | |||
287 | public Function ST_Within(Value geom1, Value geom2);
|
||
288 | |||
289 | public Function lcase(Value s);
|
||
290 | |||
291 | public Function ucase(Value s);
|
||
292 | |||
293 | public BinaryOperator and(Value op1, Value op2);
|
||
294 | |||
295 | public BinaryOperator or(Value op1, Value op2);
|
||
296 | |||
297 | public BinaryOperator eq(Value op1, Value op2);
|
||
298 | |||
299 | public BinaryOperator ne(Value op1, Value op2);
|
||
300 | |||
301 | public BinaryOperator gt(Value op1, Value op2);
|
||
302 | |||
303 | public BinaryOperator ge(Value op1, Value op2);
|
||
304 | |||
305 | public BinaryOperator lt(Value op1, Value op2);
|
||
306 | |||
307 | public BinaryOperator le(Value op1, Value op2);
|
||
308 | |||
309 | public BinaryOperator like(Value op1, Value op2);
|
||
310 | |||
311 | public BinaryOperator ilike(Value op1, Value op2);
|
||
312 | |||
313 | public BinaryOperator add(Value op1, Value op2);
|
||
314 | |||
315 | public BinaryOperator subst(Value op1, Value op2);
|
||
316 | |||
317 | public BinaryOperator mult(Value op1, Value op2);
|
||
318 | |||
319 | public BinaryOperator div(Value op1, Value op2);
|
||
320 | |||
321 | public BinaryOperator concat(Value op1, Value op2);
|
||
322 | |||
323 | public ExpressionBuilder set(Value value);
|
||
324 | |||
325 | public ExpressionBuilder and(Value value);
|
||
326 | |||
327 | public ExpressionBuilder or(Value value);
|
||
328 | |||
329 | public ExpressionBuilder createExpressionBuilder();
|
||
330 | } |