| 341 | | |
|---|
| | 340 | /** |
|---|
| | 341 | * Parses a query string into a LogicCriteria object. For example, a phrase like <em>"LAST |
|---|
| | 342 | * {CD4 COUNT} > 200"</em> is parsed into a LogicCriteria object equivalent to: |
|---|
| | 343 | * <code>new LogicCriteria("CD4 COUNT").gt(200).last()</code>. |
|---|
| | 344 | * |
|---|
| | 345 | * This function will fail quietly. If an exception occurs during parsing, then this method |
|---|
| | 346 | * will return a LogicCriteria constructed with the given query string without any parsing. |
|---|
| | 347 | * The actual work of parsing is performed by the LogicQueryParser class. |
|---|
| | 348 | * |
|---|
| | 349 | * @param query a logic query to be parsed |
|---|
| | 350 | * @return the equivalent LogicCriteria to the given query string |
|---|
| | 351 | * @see org.openmrs.logic.LogicQueryParser |
|---|
| | 352 | */ |
|---|
| | 353 | public static LogicCriteria parse(String query) { |
|---|
| | 354 | try { |
|---|
| | 355 | return LogicQueryParser.parse(query); |
|---|
| | 356 | } catch (LogicQueryParseException e) { |
|---|
| | 357 | return new LogicCriteria(query); |
|---|
| | 358 | } |
|---|
| | 359 | } |
|---|