org.openmrs.logic
Interface LogicCriteria


public interface LogicCriteria

Used to create a hierarchical representation of a criteria (e.g., similar to a parse tree). Criteria can be generated through a series of method calls; each method call returns another criteria object containing the prior criteria and the newly added criteria. This class has two purposes:

  1. provide a mechanism for building criteria
  2. provide a structure that can be passed to the DAO level for analysis & execution
In its simplest form, a criteria is equivalent to a token — e.g., the following two methods should return the same result: However, when criteria or restrictions need to be placed on the token, then a LogicCriteria can be used to define these restrictions, e.g. new LogicCriteriaImpl("CD4 COUNT").lt(200).within(Duration.months(6))


Method Summary
 LogicCriteria after(java.util.Date value)
          Add a In expression to the current LogicCriteria
 LogicCriteria and(LogicCriteria logicCriteria)
          Append the LogicCriteria using the And operator
 LogicCriteria appendCriteria(Operator operator, LogicCriteria logicCriteria)
          Append a LogicCriteria with another LogicCriteria using an operator
 LogicCriteria appendExpression(Operator operator, double operand)
           
 LogicCriteria appendExpression(Operator operator, Operand operand)
          Create a new LogicExpression using the operand and operator and then append them to the current LogicCriteria
 LogicCriteria appendExpression(Operator operator, java.lang.String operand)
           
 LogicCriteria applyTransform(Operator operator)
          Apply a transformation operator to a logic expression
 LogicCriteria asOf(java.util.Date value)
          Add a AsOf expression to the current LogicCriteria
 LogicCriteria average()
          Apply the Average operator to the LogicCriteria
 LogicCriteria before(java.util.Date value)
          Add a Before expression to the current LogicCriteria
 LogicCriteria contains(double value)
           
 LogicCriteria contains(float value)
           
 LogicCriteria contains(int value)
           
 LogicCriteria contains(Operand value)
           
 LogicCriteria contains(java.lang.String value)
          Add a Contains expression to the current LogicCriteria
 LogicCriteria count()
          Apply the Count operator to the LogicCriteria
 LogicCriteria distinct()
          Apply the Distinct operator to the LogicCriteria
 LogicCriteria equalTo(double value)
           
 LogicCriteria equalTo(float value)
           
 LogicCriteria equalTo(int value)
           
 LogicCriteria equalTo(Operand value)
           
 LogicCriteria equalTo(java.lang.String value)
          Add a Equals expression to the current LogicCriteria
 LogicCriteria exists()
           
 LogicCriteria first()
          Apply the First operator to the LogicCriteria
 LogicCriteria first(java.lang.Integer numResults)
           
 LogicCriteria first(java.lang.Integer numResults, java.lang.String sortComponent)
           
 LogicCriteria first(java.lang.String sortComponent)
           
 LogicExpression getExpression()
          Method to get the LogicExpression backing the current LogicCriteria
 java.util.Map<java.lang.String,java.lang.Object> getLogicParameters()
           
 java.lang.String getRootToken()
          Method to get the root token of the current LogicCriteria.
 LogicCriteria gt(double value)
          Add a GreaterThan expression to the current LogicCriteria
 LogicCriteria gt(float value)
           
 LogicCriteria gt(int value)
           
 LogicCriteria gt(Operand value)
           
 LogicCriteria gte(double value)
          Add a GreaterThanEquals expression to the current LogicCriteria
 LogicCriteria gte(float value)
           
 LogicCriteria gte(int value)
           
 LogicCriteria gte(Operand value)
           
 LogicCriteria in(java.util.Collection<?> value)
          Add a After expression to the current LogicCriteria
 LogicCriteria last()
          Apply the Last operator to the LogicCriteria
 LogicCriteria last(java.lang.Integer numResults)
           
 LogicCriteria lt(double value)
          Add a LessThan expression to the current LogicCriteria
 LogicCriteria lt(float value)
           
 LogicCriteria lt(int value)
           
 LogicCriteria lt(Operand value)
           
 LogicCriteria lte(double value)
          Add a LessThanEquals expression to the current LogicCriteria
 LogicCriteria lte(float value)
           
 LogicCriteria lte(int value)
           
 LogicCriteria lte(Operand value)
           
 LogicCriteria not()
           
 LogicCriteria notExists()
           
 LogicCriteria or(LogicCriteria logicCriteria)
          Append the LogicCriteria using the Or operator
 void setLogicParameters(java.util.Map<java.lang.String,java.lang.Object> logicParameters)
           
 LogicCriteria within(Duration duration)
          Add a duration expression to the current LogicCriteria
 

Method Detail

appendExpression

LogicCriteria appendExpression(Operator operator,
                               Operand operand)
Create a new LogicExpression using the operand and operator and then append them to the current LogicCriteria

Parameters:
operator - one of the Operator object to be appended to the current LogicCriteria
operand - one of the Operand object
Returns:
a new LogicCriteria containing the existing and new LogicExpression

appendExpression

LogicCriteria appendExpression(Operator operator,
                               java.lang.String operand)
See Also:
appendExpression(Operator, Operand)

appendExpression

LogicCriteria appendExpression(Operator operator,
                               double operand)
See Also:
appendExpression(Operator, Operand)

applyTransform

LogicCriteria applyTransform(Operator operator)
Apply a transformation operator to a logic expression

Parameters:
operator - type of the TransformOperator
Returns:
new logic criteria containing the TransformOperator

appendCriteria

LogicCriteria appendCriteria(Operator operator,
                             LogicCriteria logicCriteria)
Append a LogicCriteria with another LogicCriteria using an operator

Parameters:
operator - one type of Operator
logicCriteria - LogicCriteria to be appended
Returns:
new LogicCriteria containing existing and the new LogicCriteria

and

LogicCriteria and(LogicCriteria logicCriteria)
Append the LogicCriteria using the And operator

Parameters:
logicCriteria - LogicCriteria to be appended
Returns:
LogicCriteria that is the combination of existing and the new LogicCriteria
See Also:
And

or

LogicCriteria or(LogicCriteria logicCriteria)
Append the LogicCriteria using the Or operator

Parameters:
logicCriteria - LogicCriteria to be appended
Returns:
LogicCriteria that is the combination of existing and the new LogicCriteria
See Also:
Or

not

LogicCriteria not()

count

LogicCriteria count()
Apply the Count operator to the LogicCriteria

Returns:
LogicCriteria with count applied
See Also:
Count

average

LogicCriteria average()
Apply the Average operator to the LogicCriteria

Returns:
LogicCriteria with Average applied
See Also:
Average

last

LogicCriteria last()
Apply the Last operator to the LogicCriteria

Returns:
LogicCriteria with Last applied
See Also:
Last

last

LogicCriteria last(java.lang.Integer numResults)
See Also:
last()

first

LogicCriteria first()
Apply the First operator to the LogicCriteria

Returns:
LogicCriteria with First applied
See Also:
First

first

LogicCriteria first(java.lang.Integer numResults)
See Also:
first()

first

LogicCriteria first(java.lang.String sortComponent)
See Also:
first()

first

LogicCriteria first(java.lang.Integer numResults,
                    java.lang.String sortComponent)
See Also:
first()

distinct

LogicCriteria distinct()
Apply the Distinct operator to the LogicCriteria

Returns:
LogicCriteria with Distinct operator in it
See Also:
Distinct

exists

LogicCriteria exists()

notExists

LogicCriteria notExists()

asOf

LogicCriteria asOf(java.util.Date value)
Add a AsOf expression to the current LogicCriteria

Parameters:
value - the operand for the AsOf operator
Returns:
LogicCriteria with AsOf expression
See Also:
AsOf

before

LogicCriteria before(java.util.Date value)
Add a Before expression to the current LogicCriteria

Parameters:
value - the operand for the Before operator
Returns:
LogicCriteria with Before expression
See Also:
Before

after

LogicCriteria after(java.util.Date value)
Add a In expression to the current LogicCriteria

Parameters:
value - the operand for the In operator
Returns:
LogicCriteria with In expression
See Also:
In

in

LogicCriteria in(java.util.Collection<?> value)
Add a After expression to the current LogicCriteria

Parameters:
value - the operand for the After operator
Returns:
LogicCriteria with After expression
See Also:
After

contains

LogicCriteria contains(Operand value)
See Also:
contains(String)

contains

LogicCriteria contains(int value)
See Also:
contains(String)

contains

LogicCriteria contains(float value)
See Also:
contains(String)

contains

LogicCriteria contains(double value)
See Also:
contains(String)

contains

LogicCriteria contains(java.lang.String value)
Add a Contains expression to the current LogicCriteria

Parameters:
value - the operand for the Contains operator
Returns:
LogicCriteria with Contains expression
See Also:
Contains

equalTo

LogicCriteria equalTo(Operand value)
See Also:
equalTo(String)

equalTo

LogicCriteria equalTo(int value)
See Also:
equalTo(String)

equalTo

LogicCriteria equalTo(float value)
See Also:
equalTo(String)

equalTo

LogicCriteria equalTo(double value)
See Also:
equalTo(String)

equalTo

LogicCriteria equalTo(java.lang.String value)
Add a Equals expression to the current LogicCriteria

Parameters:
value - the operand for the Equals operator
Returns:
LogicCriteria with Equals expression
See Also:
Equals

gte

LogicCriteria gte(Operand value)
See Also:
gte(double)

gte

LogicCriteria gte(int value)
See Also:
gte(double)

gte

LogicCriteria gte(float value)
See Also:
gte(double)

gte

LogicCriteria gte(double value)
Add a GreaterThanEquals expression to the current LogicCriteria

Parameters:
value - the operand for the GreaterThanEquals operator
Returns:
LogicCriteria with GreaterThanEquals expression
See Also:
GreaterThanEquals

gt

LogicCriteria gt(Operand value)
See Also:
gt(double)

gt

LogicCriteria gt(int value)
See Also:
gt(double)

gt

LogicCriteria gt(float value)
See Also:
gt(double)

gt

LogicCriteria gt(double value)
Add a GreaterThan expression to the current LogicCriteria

Parameters:
value - the operand for the GreaterThan operator
Returns:
LogicCriteria with GreaterThan expression
See Also:
GreaterThan

lt

LogicCriteria lt(Operand value)
See Also:
lt(double)

lt

LogicCriteria lt(int value)
See Also:
lt(double)

lt

LogicCriteria lt(float value)
See Also:
lt(double)

lt

LogicCriteria lt(double value)
Add a LessThan expression to the current LogicCriteria

Parameters:
value - the operand for the LessThan operator
Returns:
LogicCriteria with LessThan expression
See Also:
LessThan

lte

LogicCriteria lte(Operand value)
See Also:
lte(double)

lte

LogicCriteria lte(int value)
See Also:
lte(double)

lte

LogicCriteria lte(float value)
See Also:
lte(double)

lte

LogicCriteria lte(double value)
Add a LessThanEquals expression to the current LogicCriteria

Parameters:
value - the operand for the LessThanEquals operator
Returns:
LogicCriteria with LessThanEquals expression
See Also:
LessThanEquals

within

LogicCriteria within(Duration duration)
Add a duration expression to the current LogicCriteria

Parameters:
duration - the Duration object
Returns:
LogicCriteria containing duration expression
See Also:
Within

getLogicParameters

java.util.Map<java.lang.String,java.lang.Object> getLogicParameters()
Returns:

setLogicParameters

void setLogicParameters(java.util.Map<java.lang.String,java.lang.Object> logicParameters)
Parameters:
logicParameters -

getRootToken

java.lang.String getRootToken()
Method to get the root token of the current LogicCriteria. logicService.parseString("'CD4 COUNT'").getRootToken().equals("CD4 COUNT");

Returns:
the root token of the LogicCriteria

getExpression

LogicExpression getExpression()
Method to get the LogicExpression backing the current LogicCriteria

Returns:
the LogicExpression of the current LogicCriteria

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change