-
Notifications
You must be signed in to change notification settings - Fork 15
Expression Trees
heynemann edited this page Sep 13, 2010
·
3 revisions
Home | Installing | Expression Trees | Pynq Factory
Pynq implements expression trees as means for different providers to query whatever it is that they want to query using the same language.
Unary expressions are expressions that operate on a single expression. They are always in the form of: “operator(value)”.
- Negate – Mathematically negates the given expression. i.e.: -(10)
- Not – Boolean “not” operator for the given expression. i.e.: not (item.boolean_property)
- CollectionLength – Returns the collection length for a given collection. i.e.: len(item.collection_property)
Binary expressions are expressions that take two other expressions as parameters. They are always in the form of: “value1 operator value2”.
Arithmetic:
- Add – Regular addition of two values. i.e.: 2+2
- Subtract – Regular subtraction of two values. i.e.: 2-2
- Multiply – Regular multiply of two values. i.e.: 2*2
- Divide – Regular division of two values. i.e.: 2/2
- Power – Power operation of two values. i.e.: 2 ** 2 (meaning 2 to the power of 2)
- Modulo – Modulo operation of two values. i.e.: 4 % 2 (meaning the remainder of division of 4 by 2)
Boolean:
- And – Boolean “and” operation. i.e.: True and False
- Or – Boolean “or” operation. i.e.: True or False
Comparison:
- Equal – Equality comparison. i.e.: property == 10
- NotEqual – Non-equality comparison. i.e.: property != 10
- GreaterThan – Compares if first value is greater than the second value. i.e.: 2 > 3
- GreaterThanOrEqual – Compares if first value is greater than or equal to the second value. i.e.: 2 >= 2
- LessThan – Compares if first value is less than the second value. i.e.: 3 < 2
- LessThanOrEqual – Compares if first value is less than or equal to second value. i.e.: 2 <= 2