Geode supports comparison, logical, unary, arithmetic, map, index, dot, and right arrow operators.
Comparison operators compare two values and return the results, either TRUE or FALSE.
The following are supported comparison operators:
|<=||less than or equal to|
|>=||greater than or equal to|
|!=||not equal to|
|<>||not equal to|
Regarding equality and inequality operators:
- The equality and inequality operators have lower precedence than the other comparison operators.
- The equality and inequality operators can be used with null.
- Inequality queries return results for which the search field is UNDEFINED.
- To perform equality or inequality comparisons with UNDEFINED, use the IS_DEFINED and IS_UNDEFINED preset query functions instead of these comparison operators.
The logical operators AND and OR allow you to create more complex expressions by combining expressions to produce a boolean result. When you combine two conditional expressions using the AND operator, both conditions must evaluate to true for the entire expression to be true. When you combine two conditional expressions using the OR operator, the expression evaluates to true if either one or both of the conditions are true. You can create complex expressions by combining multiple simple conditional expressions with AND and OR operators. When expressions use AND and OR operators, AND has higher precedence than OR.
Unary operators operate on a single value or expression, and have lower precedence than comparison operators in expressions. Geode supports the unary operator NOT. NOT is the negation operator, which changes the value of the operand to its opposite. For example, if an expression evaluates to TRUE, NOT changes it to FALSE. The operand must be a boolean.
Arithmetic operators operate on two values or expressions.
Any of the expected arithmetic exceptions may result,
such as overflow or a divide by zero.
QueryInvocationTargetException will be thrown,
getCause() will state
The following are supported arithmetic operators:
Map and index operators access elements in key/value collections (such as maps and regions) and ordered collections (such as arrays, lists, and
Strings). The operator is represented by a set of square brackets (
[ ]) immediately following the name of the collection. The mapping or indexing specification is provided inside these brackets.
Array, list, and
String elements are accessed using an index value. Indexing starts from zero for the first element, 1 for the second element, and so on. If
myList is an array, list, or
index is an expression that evaluates to a non-negative integer, then
myList[index] represents the (
index + 1)th element of
myList. The elements of a
String are the list of characters that make up the string.
Map and region values are accessed by key using the same syntax. The key can be any
Object. For a
Region, the map operator performs a non-distributed
get in the local cache only - with no use of
myRegion[keyExpression] is the equivalent of
The dot operator (
.) separates attribute names in a path expression, and specifies the navigation through object attributes. An alternate equivalent to the dot is the right arrow, (
->). The forward slash is used to separate region names when navigating into subregions.