Operators allow combining input information to compute a result. For a set of identical input information:
- For a given operator, the operation result will always be identical.
- For two different operators, the operation result might be different.
The result is always boolean : TRUE or FALSE.
Operators are divided in two main families, whose roles and implementations are detailed below.
Evaluation operators are used to compare one or more source value(s) with one or more reference value(s) and evaluate a result.
To get the best performance, the source value should come from the input beans, and the reference from a constant or from other input bean field. The source should not be a constant.
There are several evaluation situations:
- Source and reference are single values.
- Source is a single value; reference is a Collection (or an array).
- Source is a Collection (or an array); reference is a single value.
- Source and reference are Collections (or arryas).
Depending on the implementation, an operator might not support all possible situations.
Following implementations are provided for single values:
- BETWEEN: The source value must be between two values
- CONTAINS: The source must be a Collection, and contain the reference value.
- EMPTY: Is the source empty or null ? Handles String, Collection, Map, StringBuffer, Arrays, and every Object with a “length” or “size” method. A reference value is not accepted at compile time.
- EQ: The source value must be equal to the reference
- GT: The source value must be greater than the reference
- GTE: The source must be greater or equal to the reference
- IN: The reference must be a Collection, and contain the source value.
- LT: The source value must be less than the reference
- LTE: The source must be less than or equal to the reference
- MATCH: The source value must match a regular expression provided by the reference value.
- NE: The source value must not be equal to the reference
- NOTCONTAINS: The opposite of CONTAINS
- NOTEMPTY: The opposite of EMPTY
- NOTIN: The opposite of IN
- NOTMATCH: The opposite of MATCH
- NOTNULL: The opposite of NULL
- NULL: The source value must be null. A reference value is not accepted at compile time.
Following implementations are provided for Collections:
- COLDISJOINED : The two collections are disjoint (no elements in common)
- COLEQ : The collections are equivalent (regardless of order)
- COLIN : Equivalent to COLINCLUDED
- COLINCLUDED: The source is included in the reference.
- COLINCLUDES: The reference is included in the source.
- COLINTERSECTS: The two collections have at least one common element.
- COLNE: The collections are not equivalent (regardless of order)
- COLNOTIN: The inverse of COLINCLUDED.
These operators are used in combination with the EVAL condition.
Logical operators are used to assess the overall result of a set of conditions. They accept as an input a set of evaluation conditions results, in other words a set of Boolean values.
Following implementations are provided:
- OR: At least one condition is satisfied
- AND: All conditions are satisfied
- XOR: One and only one of the conditions is satisfied (for use with two conditions, otherwise the results can be unpredictable)
- VALBETWEEN: The number of satisfied conditions (or unsatisfied) is between two values
These operators are used in combination with:
- The CONDSET condition.
- The EVAL provided in case of iteration.