Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
08/18/08 18:27:47 (5 months ago)
Author:
vanand
Message:

openmrs-logic-api-refactoring: removed call to setRightOperand of LogicCriteria and the code for LogicQueryParser lives in logic folder

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/branches/logic-api-refactoring/src/api/org/openmrs/arden/ArdenRecognizer.g

    r5271 r5309  
    11351135; 
    11361136 
    1137 // test for Openmrs parser 
    1138 start_test  
    1139         :( (of_read_func_op) | (from_of_func_op (INTLIT )?) ) expr (temporal_comp_op iso_date_time) ?   SEMI!; 
    11401137 
    11411138/*************************************************************************************/ 
     
    20992096  
    21002097  
    2101 //(of_read_func_op) | (from_of_func_op (INTLIT )?) expr (temporal_comp_op iso_date_time) ?      SEMI;  
    2102   
    2103 start_test [LogicCriteria lc] returns [LogicCriteria lc_return = null] 
    2104 {String a = "", b=""; 
    2105 Operator transform = null, comp_op = null, temporal_op = null; 
    2106 } 
    2107 : 
    2108 ( 
    2109         (transform = of_from_AST[lc])?  
    2110         ( 
    2111                 #(ift:ID  
    2112                                       { a = ift.getText(); System.err.println("text = " + a); 
    2113                                         lc.setRightOperand(ift.getText()); 
    2114                                          
    2115                                       } 
    2116                                      
    2117                    )   
    2118                 | 
    2119                 #(ifst:STRING_LITERAL  
    2120                                       { a = ifst.getText(); System.err.println("text = " + a); 
    2121                                         lc.setRightOperand(ifst.getText()); 
    2122                                          
    2123                                       } 
    2124                                      
    2125                    ) 
    2126                 | 
    2127                 #(val:INTLIT 
    2128                                       { a = val.getText(); System.err.println("text = " + a); 
    2129                                         lc.setRightOperand(val.getText()); 
    2130                                       } 
    2131                  
    2132                 )       
    2133         )        
    2134         ( 
    2135                 (              
    2136                         comp_op = simple_comp_op_for_test[lc,a]   
    2137                         ( 
    2138                                 #(idt:ID  
    2139                                               { b += idt.getText(); System.err.println("text = " + b); 
    2140                                                 LogicCriteria ac = new LogicCriteria(comp_op, b); 
    2141                                                 lc = lc.appendCriteria(Operator.AND, ac); 
    2142                                                     //System.out.println(lc.toString());  
    2143                                               } 
    2144                                              
    2145                             ) 
    2146                             | 
    2147                                 #(idstr:STRING_LITERAL  
    2148                                                   { b += idstr.getText(); System.err.println("text = " + b); 
    2149                                                         LogicCriteria ac = new LogicCriteria(comp_op, b); 
    2150                                                 lc = lc.appendCriteria(Operator.AND, ac); 
    2151                                                     //System.out.println(lc.toString()); 
    2152                                                   } 
    2153                                                      
    2154                                    ) 
    2155                                 | 
    2156                                 #(valstr:INTLIT 
    2157                                                   { b += valstr.getText(); System.err.println("text = " + b); 
    2158                                                         LogicCriteria ac = new LogicCriteria(comp_op, b); 
    2159                                                 lc = lc.appendCriteria(Operator.AND, ac); 
    2160                                                     //System.out.println(lc.toString()); 
    2161                                                   } 
    2162                                  
    2163                                 )       
    2164                         ) 
    2165                 ) ? 
    2166                 | 
    2167                 ( 
    2168                         temporal_op = temporal_comp_op_for_test[lc,a]   
    2169                         ( 
    2170                                 {GregorianCalendar gc = new GregorianCalendar();} b = dateAST [gc]  
    2171                                                   {  
    2172                                                         LogicCriteria ac = new LogicCriteria(temporal_op, gc); 
    2173                                                 lc = lc.appendCriteria(Operator.AND, ac); 
    2174                                                     System.out.println(gc.toString()); 
    2175                                                     {System.err.println("date = " + b);} 
    2176                                                   } 
    2177                                                   
    2178                                  
    2179                                      
    2180                         ) 
    2181                 )? 
    2182         )  
    2183         { 
    2184                 lc_return = lc.applyTransform(transform); 
    2185                 //System.out.println(lc_return.toString()); 
    2186                 return lc_return; 
    2187         }                       
    2188 ) 
    2189 ; 
    21902098 
    21912099dateAST [GregorianCalendar calendar] returns [String s = ""] 
     
    22162124        ; 
    22172125 
    2218 simple_comp_op_for_test[LogicCriteria lc, String operand] returns [Operator s = null] 
    2219 {String a,b;} 
    2220 : 
    2221 ( 
    2222    #(EQUALS { 
    2223                                 System.err.println("Found = "); 
    2224                                 s = Operator.EQUALS; 
    2225                         } 
    2226          ) 
    2227         | 
    2228         #(GTE { 
    2229                                 System.err.println("Found >= "); 
    2230                                 s = Operator.GTE; 
    2231                         } 
    2232          ) 
    2233          | 
    2234          #(GT { 
    2235                                 System.err.println("Found > "); 
    2236                                 s = Operator.GT;  
    2237                         } 
    2238          ) 
    2239          | 
    2240          #(LT { 
    2241                                 System.err.println("Found < "); 
    2242                                 s = Operator.LT; 
    2243                                   
    2244                         } 
    2245          ) 
    2246          | 
    2247          #(LTE { 
    2248                                 System.err.println("Found <= "); 
    2249                                 s = Operator.LTE;  
    2250                         } 
    2251          ) 
    2252          #(NE { 
    2253                                 System.err.println("Found <> "); 
    2254                                 s = Operator.NOT_EXISTS;  
    2255                         } 
    2256          ) 
    2257 ) 
    2258 ; 
    2259  
    2260 temporal_comp_op_for_test[LogicCriteria lc, String operand] returns [Operator s = null] 
    2261 {String a,b;} 
    2262 : 
    2263 ( 
    2264    #(BEFORE { 
    2265                                 System.err.println("Found BEFORE "); 
    2266                                 s = Operator.BEFORE; 
    2267                         } 
    2268          ) 
    2269         | 
    2270         #(AFTER { 
    2271                                 System.err.println("Found AFTER "); 
    2272                                 s = Operator.AFTER; 
    2273                         } 
    2274          ) 
    2275           
    2276 ) 
    2277 ; 
    2278  
    2279  
    2280 of_from_AST [LogicCriteria lc] returns [Operator s = null] 
    2281 {} 
    2282 : 
    2283           ( (LAST | LATEST)  
    2284           {s = Operator.LAST; } 
    2285           ) 
    2286           | 
    2287           ( (FIRST | EARLIEST)  
    2288           {s = Operator.FIRST; } 
    2289           ) 
    2290           | 
    2291           ( (EXIST | EXISTS)  
    2292           {s = Operator.EXISTS; } 
    2293           ) 
    2294             
    2295  
    2296  
    2297 ;  
    2298   
    22992126 
    23002127/*************************************************************************************/