EMMA Coverage Report (generated Tue Jul 10 07:50:22 IST 2012)
[all classes][org.wso2.siddhi.core.util.parser]

COVERAGE SUMMARY FOR SOURCE FILE [ComparatorParser.java]

nameclass, %method, %block, %line, %
ComparatorParser.java100% (2/2)62%  (5/8)11%  (143/1264)8%   (16.9/201)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComparatorParser100% (1/1)57%  (4/7)8%   (102/1217)8%   (17/201)
ComparatorParser (): void 0%   (0/1)0%   (0/3)0%   (0/2)
parseGreaterThanEqualCompare (ExpressionExecutor, ExpressionExecutor): Condit... 0%   (0/1)0%   (0/189)0%   (0/32)
parseNotEqualCompare (ExpressionExecutor, ExpressionExecutor): ConditionExecutor 0%   (0/1)0%   (0/229)0%   (0/36)
parseEqualCompare (ExpressionExecutor, ExpressionExecutor): ConditionExecutor 100% (1/1)8%   (18/229)8%   (3/36)
parseLessThanCompare (ExpressionExecutor, ExpressionExecutor): ConditionExecutor 100% (1/1)10%  (18/189)9%   (3/32)
parseLessThanEqualCompare (ExpressionExecutor, ExpressionExecutor): Condition... 100% (1/1)10%  (18/189)9%   (3/32)
parseGreaterThanCompare (ExpressionExecutor, ExpressionExecutor): ConditionEx... 100% (1/1)25%  (48/189)25%  (8/32)
     
class ComparatorParser$1100% (1/1)100% (1/1)87%  (41/47)87%  (0.9/1)
<static initializer> 100% (1/1)87%  (41/47)87%  (0.9/1)

1package org.wso2.siddhi.core.util.parser;
2 
3import org.wso2.siddhi.core.exception.OperationNotSupportedException;
4import org.wso2.siddhi.core.executor.conditon.ConditionExecutor;
5import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorBoolBool;
6import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorDoubleDouble;
7import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorDoubleFloat;
8import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorDoubleInt;
9import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorDoubleLong;
10import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorFloatDouble;
11import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorFloatFloat;
12import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorFloatInt;
13import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorFloatLong;
14import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorIntDouble;
15import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorIntFloat;
16import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorIntInt;
17import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorIntLong;
18import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorLongDouble;
19import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorLongFloat;
20import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorLongInt;
21import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorLongLong;
22import org.wso2.siddhi.core.executor.conditon.compare.equal.EqualCompareConditionExecutorStringString;
23import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorDoubleDouble;
24import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorDoubleFloat;
25import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorDoubleInt;
26import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorDoubleLong;
27import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorFloatDouble;
28import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorFloatFloat;
29import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorFloatInt;
30import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorFloatLong;
31import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorIntDouble;
32import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorIntFloat;
33import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorIntInt;
34import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorIntLong;
35import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorLongDouble;
36import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorLongFloat;
37import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorLongInt;
38import org.wso2.siddhi.core.executor.conditon.compare.greater_than.GreaterThanCompareConditionExecutorLongLong;
39import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorDoubleDouble;
40import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorDoubleFloat;
41import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorDoubleInt;
42import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorDoubleLong;
43import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorFloatDouble;
44import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorFloatFloat;
45import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorFloatInt;
46import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorFloatLong;
47import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorIntDouble;
48import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorIntFloat;
49import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorIntInt;
50import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorIntLong;
51import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorLongDouble;
52import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorLongFloat;
53import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorLongInt;
54import org.wso2.siddhi.core.executor.conditon.compare.greater_than_equal.GreaterThanEqualCompareConditionExecutorLongLong;
55import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorDoubleDouble;
56import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorDoubleFloat;
57import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorDoubleInt;
58import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorDoubleLong;
59import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorFloatDouble;
60import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorFloatFloat;
61import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorFloatInt;
62import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorFloatLong;
63import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorIntDouble;
64import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorIntFloat;
65import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorIntInt;
66import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorIntLong;
67import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorLongDouble;
68import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorLongFloat;
69import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorLongInt;
70import org.wso2.siddhi.core.executor.conditon.compare.less_than.LessThanCompareConditionExecutorLongLong;
71import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorDoubleDouble;
72import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorDoubleFloat;
73import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorDoubleInt;
74import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorDoubleLong;
75import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorFloatDouble;
76import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorFloatFloat;
77import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorFloatInt;
78import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorFloatLong;
79import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorIntDouble;
80import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorIntFloat;
81import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorIntInt;
82import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorIntLong;
83import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorLongDouble;
84import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorLongFloat;
85import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorLongInt;
86import org.wso2.siddhi.core.executor.conditon.compare.less_than_equal.LessThanEqualCompareConditionExecutorLongLong;
87import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorBoolBool;
88import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorDoubleDouble;
89import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorDoubleFloat;
90import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorDoubleInt;
91import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorDoubleLong;
92import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorFloatDouble;
93import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorFloatFloat;
94import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorFloatInt;
95import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorFloatLong;
96import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorIntDouble;
97import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorIntFloat;
98import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorIntInt;
99import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorIntLong;
100import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorLongDouble;
101import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorLongFloat;
102import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorLongInt;
103import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorLongLong;
104import org.wso2.siddhi.core.executor.conditon.compare.not_equal.NotEqualCompareConditionExecutorStringString;
105import org.wso2.siddhi.core.executor.expression.ExpressionExecutor;
106 
107public class ComparatorParser {
108    public static ConditionExecutor parseGreaterThanCompare(
109            ExpressionExecutor leftExpressionExecutor, ExpressionExecutor rightExpressionExecutor) {
110        switch (leftExpressionExecutor.getType()) {
111            case STRING:
112                throw new OperationNotSupportedException("string cannot used in greater than comparisons");
113            case INT:
114                switch (rightExpressionExecutor.getType()) {
115                    case STRING:
116                        throw new OperationNotSupportedException("int cannot be compared with string");
117                    case INT:
118                        return new GreaterThanCompareConditionExecutorIntInt(leftExpressionExecutor, rightExpressionExecutor);
119                    case LONG:
120                        return new GreaterThanCompareConditionExecutorIntLong(leftExpressionExecutor, rightExpressionExecutor);
121                    case FLOAT:
122                        return new GreaterThanCompareConditionExecutorIntFloat(leftExpressionExecutor, rightExpressionExecutor);
123                    case DOUBLE:
124                        return new GreaterThanCompareConditionExecutorIntDouble(leftExpressionExecutor, rightExpressionExecutor);
125                    case BOOL:
126                        throw new OperationNotSupportedException("int cannot be compared with bool");
127                }
128            case LONG:
129                switch (rightExpressionExecutor.getType()) {
130                    case STRING:
131                        throw new OperationNotSupportedException("long cannot be compared with string");
132                    case INT:
133                        return new GreaterThanCompareConditionExecutorLongInt(leftExpressionExecutor, rightExpressionExecutor);
134                    case LONG:
135                        return new GreaterThanCompareConditionExecutorLongLong(leftExpressionExecutor, rightExpressionExecutor);
136                    case FLOAT:
137                        return new GreaterThanCompareConditionExecutorLongFloat(leftExpressionExecutor, rightExpressionExecutor);
138                    case DOUBLE:
139                        return new GreaterThanCompareConditionExecutorLongDouble(leftExpressionExecutor, rightExpressionExecutor);
140                    case BOOL:
141                        throw new OperationNotSupportedException("int cannot be compared with bool");
142                }
143            case FLOAT:
144                switch (rightExpressionExecutor.getType()) {
145                    case STRING:
146                        throw new OperationNotSupportedException("float cannot be compared with string");
147                    case INT:
148                        return new GreaterThanCompareConditionExecutorFloatInt(leftExpressionExecutor, rightExpressionExecutor);
149                    case LONG:
150                        return new GreaterThanCompareConditionExecutorFloatLong(leftExpressionExecutor, rightExpressionExecutor);
151                    case FLOAT:
152                        return new GreaterThanCompareConditionExecutorFloatFloat(leftExpressionExecutor, rightExpressionExecutor);
153                    case DOUBLE:
154                        return new GreaterThanCompareConditionExecutorFloatDouble(leftExpressionExecutor, rightExpressionExecutor);
155                    case BOOL:
156                        throw new OperationNotSupportedException("int cannot be compared with bool");
157                }
158            case DOUBLE:
159                switch (rightExpressionExecutor.getType()) {
160                    case STRING:
161                        throw new OperationNotSupportedException("float cannot be compared with string");
162                    case INT:
163                        return new GreaterThanCompareConditionExecutorDoubleInt(leftExpressionExecutor, rightExpressionExecutor);
164                    case LONG:
165                        return new GreaterThanCompareConditionExecutorDoubleLong(leftExpressionExecutor, rightExpressionExecutor);
166                    case FLOAT:
167                        return new GreaterThanCompareConditionExecutorDoubleFloat(leftExpressionExecutor, rightExpressionExecutor);
168                    case DOUBLE:
169                        return new GreaterThanCompareConditionExecutorDoubleDouble(leftExpressionExecutor, rightExpressionExecutor);
170                    case BOOL:
171                        throw new OperationNotSupportedException("int cannot be compared with bool");
172                }
173            case BOOL:
174                throw new OperationNotSupportedException("bool cannot used in greater than comparisons");
175        }
176        throw new OperationNotSupportedException(leftExpressionExecutor.getType() + " cannot be used in greater than comparisons");
177    }
178 
179 
180    public static ConditionExecutor parseGreaterThanEqualCompare(
181            ExpressionExecutor leftExpressionExecutor, ExpressionExecutor rightExpressionExecutor) {
182        switch (leftExpressionExecutor.getType()) {
183            case STRING:
184                throw new OperationNotSupportedException("string cannot used in greater than equal comparisons");
185            case INT:
186                switch (rightExpressionExecutor.getType()) {
187                    case STRING:
188                        throw new OperationNotSupportedException("int cannot be compared with string");
189                    case INT:
190                        return new GreaterThanEqualCompareConditionExecutorIntInt(leftExpressionExecutor, rightExpressionExecutor);
191                    case LONG:
192                        return new GreaterThanEqualCompareConditionExecutorIntLong(leftExpressionExecutor, rightExpressionExecutor);
193                    case FLOAT:
194                        return new GreaterThanEqualCompareConditionExecutorIntFloat(leftExpressionExecutor, rightExpressionExecutor);
195                    case DOUBLE:
196                        return new GreaterThanEqualCompareConditionExecutorIntDouble(leftExpressionExecutor, rightExpressionExecutor);
197                    case BOOL:
198                        throw new OperationNotSupportedException("int cannot be compared with bool");
199                }
200            case LONG:
201                switch (rightExpressionExecutor.getType()) {
202                    case STRING:
203                        throw new OperationNotSupportedException("long cannot be compared with string");
204                    case INT:
205                        return new GreaterThanEqualCompareConditionExecutorLongInt(leftExpressionExecutor, rightExpressionExecutor);
206                    case LONG:
207                        return new GreaterThanEqualCompareConditionExecutorLongLong(leftExpressionExecutor, rightExpressionExecutor);
208                    case FLOAT:
209                        return new GreaterThanEqualCompareConditionExecutorLongFloat(leftExpressionExecutor, rightExpressionExecutor);
210                    case DOUBLE:
211                        return new GreaterThanEqualCompareConditionExecutorLongDouble(leftExpressionExecutor, rightExpressionExecutor);
212                    case BOOL:
213                        throw new OperationNotSupportedException("int cannot be compared with bool");
214                }
215            case FLOAT:
216                switch (rightExpressionExecutor.getType()) {
217                    case STRING:
218                        throw new OperationNotSupportedException("float cannot be compared with string");
219                    case INT:
220                        return new GreaterThanEqualCompareConditionExecutorFloatInt(leftExpressionExecutor, rightExpressionExecutor);
221                    case LONG:
222                        return new GreaterThanEqualCompareConditionExecutorFloatLong(leftExpressionExecutor, rightExpressionExecutor);
223                    case FLOAT:
224                        return new GreaterThanEqualCompareConditionExecutorFloatFloat(leftExpressionExecutor, rightExpressionExecutor);
225                    case DOUBLE:
226                        return new GreaterThanEqualCompareConditionExecutorFloatDouble(leftExpressionExecutor, rightExpressionExecutor);
227                    case BOOL:
228                        throw new OperationNotSupportedException("int cannot be compared with bool");
229                }
230            case DOUBLE:
231                switch (rightExpressionExecutor.getType()) {
232                    case STRING:
233                        throw new OperationNotSupportedException("float cannot be compared with string");
234                    case INT:
235                        return new GreaterThanEqualCompareConditionExecutorDoubleInt(leftExpressionExecutor, rightExpressionExecutor);
236                    case LONG:
237                        return new GreaterThanEqualCompareConditionExecutorDoubleLong(leftExpressionExecutor, rightExpressionExecutor);
238                    case FLOAT:
239                        return new GreaterThanEqualCompareConditionExecutorDoubleFloat(leftExpressionExecutor, rightExpressionExecutor);
240                    case DOUBLE:
241                        return new GreaterThanEqualCompareConditionExecutorDoubleDouble(leftExpressionExecutor, rightExpressionExecutor);
242                    case BOOL:
243                        throw new OperationNotSupportedException("int cannot be compared with bool");
244                }
245            case BOOL:
246                throw new OperationNotSupportedException("bool cannot used in greater than equal comparisons");
247        }
248        throw new OperationNotSupportedException(leftExpressionExecutor.getType() + " cannot be used in greater than equal comparisons");
249    }
250 
251    public static ConditionExecutor parseLessThanCompare(
252            ExpressionExecutor leftExpressionExecutor, ExpressionExecutor rightExpressionExecutor) {
253        switch (leftExpressionExecutor.getType()) {
254            case STRING:
255                throw new OperationNotSupportedException("string cannot used in less than comparisons");
256            case INT:
257                switch (rightExpressionExecutor.getType()) {
258                    case STRING:
259                        throw new OperationNotSupportedException("int cannot be compared with string");
260                    case INT:
261                        return new LessThanCompareConditionExecutorIntInt(leftExpressionExecutor, rightExpressionExecutor);
262                    case LONG:
263                        return new LessThanCompareConditionExecutorIntLong(leftExpressionExecutor, rightExpressionExecutor);
264                    case FLOAT:
265                        return new LessThanCompareConditionExecutorIntFloat(leftExpressionExecutor, rightExpressionExecutor);
266                    case DOUBLE:
267                        return new LessThanCompareConditionExecutorIntDouble(leftExpressionExecutor, rightExpressionExecutor);
268                    case BOOL:
269                        throw new OperationNotSupportedException("int cannot be compared with bool");
270                }
271            case LONG:
272                switch (rightExpressionExecutor.getType()) {
273                    case STRING:
274                        throw new OperationNotSupportedException("long cannot be compared with string");
275                    case INT:
276                        return new LessThanCompareConditionExecutorLongInt(leftExpressionExecutor, rightExpressionExecutor);
277                    case LONG:
278                        return new LessThanCompareConditionExecutorLongLong(leftExpressionExecutor, rightExpressionExecutor);
279                    case FLOAT:
280                        return new LessThanCompareConditionExecutorLongFloat(leftExpressionExecutor, rightExpressionExecutor);
281                    case DOUBLE:
282                        return new LessThanCompareConditionExecutorLongDouble(leftExpressionExecutor, rightExpressionExecutor);
283                    case BOOL:
284                        throw new OperationNotSupportedException("int cannot be compared with bool");
285                }
286            case FLOAT:
287                switch (rightExpressionExecutor.getType()) {
288                    case STRING:
289                        throw new OperationNotSupportedException("float cannot be compared with string");
290                    case INT:
291                        return new LessThanCompareConditionExecutorFloatInt(leftExpressionExecutor, rightExpressionExecutor);
292                    case LONG:
293                        return new LessThanCompareConditionExecutorFloatLong(leftExpressionExecutor, rightExpressionExecutor);
294                    case FLOAT:
295                        return new LessThanCompareConditionExecutorFloatFloat(leftExpressionExecutor, rightExpressionExecutor);
296                    case DOUBLE:
297                        return new LessThanCompareConditionExecutorFloatDouble(leftExpressionExecutor, rightExpressionExecutor);
298                    case BOOL:
299                        throw new OperationNotSupportedException("int cannot be compared with bool");
300                }
301            case DOUBLE:
302                switch (rightExpressionExecutor.getType()) {
303                    case STRING:
304                        throw new OperationNotSupportedException("float cannot be compared with string");
305                    case INT:
306                        return new LessThanCompareConditionExecutorDoubleInt(leftExpressionExecutor, rightExpressionExecutor);
307                    case LONG:
308                        return new LessThanCompareConditionExecutorDoubleLong(leftExpressionExecutor, rightExpressionExecutor);
309                    case FLOAT:
310                        return new LessThanCompareConditionExecutorDoubleFloat(leftExpressionExecutor, rightExpressionExecutor);
311                    case DOUBLE:
312                        return new LessThanCompareConditionExecutorDoubleDouble(leftExpressionExecutor, rightExpressionExecutor);
313                    case BOOL:
314                        throw new OperationNotSupportedException("int cannot be compared with bool");
315                }
316            case BOOL:
317                throw new OperationNotSupportedException("bool cannot used in less than comparisons");
318        }
319        throw new OperationNotSupportedException(leftExpressionExecutor.getType() + " cannot be used in less than comparisons");
320    }
321 
322    public static ConditionExecutor parseLessThanEqualCompare(
323            ExpressionExecutor leftExpressionExecutor, ExpressionExecutor rightExpressionExecutor) {
324        switch (leftExpressionExecutor.getType()) {
325            case STRING:
326                throw new OperationNotSupportedException("string cannot used in less than equal comparisons");
327            case INT:
328                switch (rightExpressionExecutor.getType()) {
329                    case STRING:
330                        throw new OperationNotSupportedException("int cannot be compared with string");
331                    case INT:
332                        return new LessThanEqualCompareConditionExecutorIntInt(leftExpressionExecutor, rightExpressionExecutor);
333                    case LONG:
334                        return new LessThanEqualCompareConditionExecutorIntLong(leftExpressionExecutor, rightExpressionExecutor);
335                    case FLOAT:
336                        return new LessThanEqualCompareConditionExecutorIntFloat(leftExpressionExecutor, rightExpressionExecutor);
337                    case DOUBLE:
338                        return new LessThanEqualCompareConditionExecutorIntDouble(leftExpressionExecutor, rightExpressionExecutor);
339                    case BOOL:
340                        throw new OperationNotSupportedException("int cannot be compared with bool");
341                }
342            case LONG:
343                switch (rightExpressionExecutor.getType()) {
344                    case STRING:
345                        throw new OperationNotSupportedException("long cannot be compared with string");
346                    case INT:
347                        return new LessThanEqualCompareConditionExecutorLongInt(leftExpressionExecutor, rightExpressionExecutor);
348                    case LONG:
349                        return new LessThanEqualCompareConditionExecutorLongLong(leftExpressionExecutor, rightExpressionExecutor);
350                    case FLOAT:
351                        return new LessThanEqualCompareConditionExecutorLongFloat(leftExpressionExecutor, rightExpressionExecutor);
352                    case DOUBLE:
353                        return new LessThanEqualCompareConditionExecutorLongDouble(leftExpressionExecutor, rightExpressionExecutor);
354                    case BOOL:
355                        throw new OperationNotSupportedException("int cannot be compared with bool");
356                }
357            case FLOAT:
358                switch (rightExpressionExecutor.getType()) {
359                    case STRING:
360                        throw new OperationNotSupportedException("float cannot be compared with string");
361                    case INT:
362                        return new LessThanEqualCompareConditionExecutorFloatInt(leftExpressionExecutor, rightExpressionExecutor);
363                    case LONG:
364                        return new LessThanEqualCompareConditionExecutorFloatLong(leftExpressionExecutor, rightExpressionExecutor);
365                    case FLOAT:
366                        return new LessThanEqualCompareConditionExecutorFloatFloat(leftExpressionExecutor, rightExpressionExecutor);
367                    case DOUBLE:
368                        return new LessThanEqualCompareConditionExecutorFloatDouble(leftExpressionExecutor, rightExpressionExecutor);
369                    case BOOL:
370                        throw new OperationNotSupportedException("int cannot be compared with bool");
371                }
372            case DOUBLE:
373                switch (rightExpressionExecutor.getType()) {
374                    case STRING:
375                        throw new OperationNotSupportedException("float cannot be compared with string");
376                    case INT:
377                        return new LessThanEqualCompareConditionExecutorDoubleInt(leftExpressionExecutor, rightExpressionExecutor);
378                    case LONG:
379                        return new LessThanEqualCompareConditionExecutorDoubleLong(leftExpressionExecutor, rightExpressionExecutor);
380                    case FLOAT:
381                        return new LessThanEqualCompareConditionExecutorDoubleFloat(leftExpressionExecutor, rightExpressionExecutor);
382                    case DOUBLE:
383                        return new LessThanEqualCompareConditionExecutorDoubleDouble(leftExpressionExecutor, rightExpressionExecutor);
384                    case BOOL:
385                        throw new OperationNotSupportedException("int cannot be compared with bool");
386                }
387            case BOOL:
388                throw new OperationNotSupportedException("bool cannot used in less than equal comparisons");
389        }
390        throw new OperationNotSupportedException(leftExpressionExecutor.getType() + " cannot be used in less than equal comparisons");
391    }
392 
393    public static ConditionExecutor parseEqualCompare(
394            ExpressionExecutor leftExpressionExecutor, ExpressionExecutor rightExpressionExecutor) {
395        switch (leftExpressionExecutor.getType()) {
396            case STRING:
397                switch (rightExpressionExecutor.getType()) {
398                    case STRING:
399                        return new EqualCompareConditionExecutorStringString(leftExpressionExecutor, rightExpressionExecutor);
400                    default:
401                        throw new OperationNotSupportedException("sting cannot be compared with " + rightExpressionExecutor.getType());
402                }
403            case INT:
404                switch (rightExpressionExecutor.getType()) {
405                    case STRING:
406                        throw new OperationNotSupportedException("int cannot be compared with string");
407                    case INT:
408                        return new EqualCompareConditionExecutorIntInt(leftExpressionExecutor, rightExpressionExecutor);
409                    case LONG:
410                        return new EqualCompareConditionExecutorIntLong(leftExpressionExecutor, rightExpressionExecutor);
411                    case FLOAT:
412                        return new EqualCompareConditionExecutorIntFloat(leftExpressionExecutor, rightExpressionExecutor);
413                    case DOUBLE:
414                        return new EqualCompareConditionExecutorIntDouble(leftExpressionExecutor, rightExpressionExecutor);
415                    case BOOL:
416                        throw new OperationNotSupportedException("int cannot be compared with bool");
417                }
418            case LONG:
419                switch (rightExpressionExecutor.getType()) {
420                    case STRING:
421                        throw new OperationNotSupportedException("long cannot be compared with string");
422                    case INT:
423                        return new EqualCompareConditionExecutorLongInt(leftExpressionExecutor, rightExpressionExecutor);
424                    case LONG:
425                        return new EqualCompareConditionExecutorLongLong(leftExpressionExecutor, rightExpressionExecutor);
426                    case FLOAT:
427                        return new EqualCompareConditionExecutorLongFloat(leftExpressionExecutor, rightExpressionExecutor);
428                    case DOUBLE:
429                        return new EqualCompareConditionExecutorLongDouble(leftExpressionExecutor, rightExpressionExecutor);
430                    case BOOL:
431                        throw new OperationNotSupportedException("int cannot be compared with bool");
432                }
433            case FLOAT:
434                switch (rightExpressionExecutor.getType()) {
435                    case STRING:
436                        throw new OperationNotSupportedException("float cannot be compared with string");
437                    case INT:
438                        return new EqualCompareConditionExecutorFloatInt(leftExpressionExecutor, rightExpressionExecutor);
439                    case LONG:
440                        return new EqualCompareConditionExecutorFloatLong(leftExpressionExecutor, rightExpressionExecutor);
441                    case FLOAT:
442                        return new EqualCompareConditionExecutorFloatFloat(leftExpressionExecutor, rightExpressionExecutor);
443                    case DOUBLE:
444                        return new EqualCompareConditionExecutorFloatDouble(leftExpressionExecutor, rightExpressionExecutor);
445                    case BOOL:
446                        throw new OperationNotSupportedException("int cannot be compared with bool");
447                }
448            case DOUBLE:
449                switch (rightExpressionExecutor.getType()) {
450                    case STRING:
451                        throw new OperationNotSupportedException("float cannot be compared with string");
452                    case INT:
453                        return new EqualCompareConditionExecutorDoubleInt(leftExpressionExecutor, rightExpressionExecutor);
454                    case LONG:
455                        return new EqualCompareConditionExecutorDoubleLong(leftExpressionExecutor, rightExpressionExecutor);
456                    case FLOAT:
457                        return new EqualCompareConditionExecutorDoubleFloat(leftExpressionExecutor, rightExpressionExecutor);
458                    case DOUBLE:
459                        return new EqualCompareConditionExecutorDoubleDouble(leftExpressionExecutor, rightExpressionExecutor);
460                    case BOOL:
461                        throw new OperationNotSupportedException("int cannot be compared with bool");
462                }
463            case BOOL:
464                switch (rightExpressionExecutor.getType()) {
465                    case STRING:
466                        return new EqualCompareConditionExecutorBoolBool(leftExpressionExecutor, rightExpressionExecutor);
467                    default:
468                        throw new OperationNotSupportedException("bool cannot be compared with " + rightExpressionExecutor.getType());
469                }
470        }
471        throw new OperationNotSupportedException(leftExpressionExecutor.getType() + " cannot be used  equal comparisons");
472    }
473 
474    public static ConditionExecutor parseNotEqualCompare(
475            ExpressionExecutor leftExpressionExecutor, ExpressionExecutor rightExpressionExecutor) {
476        switch (leftExpressionExecutor.getType()) {
477            case STRING:
478                switch (rightExpressionExecutor.getType()) {
479                    case STRING:
480                        return new NotEqualCompareConditionExecutorStringString(leftExpressionExecutor, rightExpressionExecutor);
481                    default:
482                        throw new OperationNotSupportedException("sting cannot be compared with " + rightExpressionExecutor.getType());
483                }
484            case INT:
485                switch (rightExpressionExecutor.getType()) {
486                    case STRING:
487                        throw new OperationNotSupportedException("int cannot be compared with string");
488                    case INT:
489                        return new NotEqualCompareConditionExecutorIntInt(leftExpressionExecutor, rightExpressionExecutor);
490                    case LONG:
491                        return new NotEqualCompareConditionExecutorIntLong(leftExpressionExecutor, rightExpressionExecutor);
492                    case FLOAT:
493                        return new NotEqualCompareConditionExecutorIntFloat(leftExpressionExecutor, rightExpressionExecutor);
494                    case DOUBLE:
495                        return new NotEqualCompareConditionExecutorIntDouble(leftExpressionExecutor, rightExpressionExecutor);
496                    case BOOL:
497                        throw new OperationNotSupportedException("int cannot be compared with bool");
498                }
499            case LONG:
500                switch (rightExpressionExecutor.getType()) {
501                    case STRING:
502                        throw new OperationNotSupportedException("long cannot be compared with string");
503                    case INT:
504                        return new NotEqualCompareConditionExecutorLongInt(leftExpressionExecutor, rightExpressionExecutor);
505                    case LONG:
506                        return new NotEqualCompareConditionExecutorLongLong(leftExpressionExecutor, rightExpressionExecutor);
507                    case FLOAT:
508                        return new NotEqualCompareConditionExecutorLongFloat(leftExpressionExecutor, rightExpressionExecutor);
509                    case DOUBLE:
510                        return new NotEqualCompareConditionExecutorLongDouble(leftExpressionExecutor, rightExpressionExecutor);
511                    case BOOL:
512                        throw new OperationNotSupportedException("int cannot be compared with bool");
513                }
514            case FLOAT:
515                switch (rightExpressionExecutor.getType()) {
516                    case STRING:
517                        throw new OperationNotSupportedException("float cannot be compared with string");
518                    case INT:
519                        return new NotEqualCompareConditionExecutorFloatInt(leftExpressionExecutor, rightExpressionExecutor);
520                    case LONG:
521                        return new NotEqualCompareConditionExecutorFloatLong(leftExpressionExecutor, rightExpressionExecutor);
522                    case FLOAT:
523                        return new NotEqualCompareConditionExecutorFloatFloat(leftExpressionExecutor, rightExpressionExecutor);
524                    case DOUBLE:
525                        return new NotEqualCompareConditionExecutorFloatDouble(leftExpressionExecutor, rightExpressionExecutor);
526                    case BOOL:
527                        throw new OperationNotSupportedException("int cannot be compared with bool");
528                }
529            case DOUBLE:
530                switch (rightExpressionExecutor.getType()) {
531                    case STRING:
532                        throw new OperationNotSupportedException("float cannot be compared with string");
533                    case INT:
534                        return new NotEqualCompareConditionExecutorDoubleInt(leftExpressionExecutor, rightExpressionExecutor);
535                    case LONG:
536                        return new NotEqualCompareConditionExecutorDoubleLong(leftExpressionExecutor, rightExpressionExecutor);
537                    case FLOAT:
538                        return new NotEqualCompareConditionExecutorDoubleFloat(leftExpressionExecutor, rightExpressionExecutor);
539                    case DOUBLE:
540                        return new NotEqualCompareConditionExecutorDoubleDouble(leftExpressionExecutor, rightExpressionExecutor);
541                    case BOOL:
542                        throw new OperationNotSupportedException("int cannot be compared with bool");
543                }
544            case BOOL:
545                switch (rightExpressionExecutor.getType()) {
546                    case STRING:
547                        return new NotEqualCompareConditionExecutorBoolBool(leftExpressionExecutor, rightExpressionExecutor);
548                    default:
549                        throw new OperationNotSupportedException("bool cannot be compared with " + rightExpressionExecutor.getType());
550                }
551        }
552        throw new OperationNotSupportedException(leftExpressionExecutor.getType() + " cannot be used in not equal comparisons");
553    }
554 
555 
556}

[all classes][org.wso2.siddhi.core.util.parser]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov