Class NumberExtensions
java.lang.Object
org.openhab.core.model.script.lib.NumberExtensions
This class contains all kinds of extensions to be used by scripts and not
provided by Xbase. These include things like number handling and comparisons.
- Author:
- Kai Kreuzer - Initial contribution
-
Field Summary
Modifier and TypeFieldDescriptionstatic final BigDecimal
It is the definition of Java null pointer for the rules language. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimal
numberToBigDecimal
(Number number) Convert the given number into a BigDecimalstatic BigDecimal
operator_divide
(Number x, Number y) static QuantityType
<?> operator_divide
(Number x, QuantityType<?> y) static QuantityType
<?> operator_divide
(QuantityType<?> x, Number y) static QuantityType
<?> operator_divide
(QuantityType<?> x, QuantityType<?> y) static boolean
operator_equals
(Number left, Number right) static boolean
operator_equals
(QuantityType<?> left, Number right) static boolean
operator_equals
(QuantityType<?> left, QuantityType<?> right) static boolean
operator_equals
(Type type, Number x) static boolean
operator_greaterEqualsThan
(Number left, Number right) static boolean
operator_greaterEqualsThan
(QuantityType<?> x, Number y) static boolean
operator_greaterEqualsThan
(QuantityType<?> x, QuantityType<?> y) static boolean
operator_greaterEqualsThan
(Type type, Number x) static boolean
operator_greaterThan
(Number left, Number right) static boolean
operator_greaterThan
(QuantityType<?> x, Number y) static boolean
operator_greaterThan
(QuantityType<?> x, QuantityType<?> y) static boolean
operator_greaterThan
(Type type, Number x) static boolean
operator_lessEqualsThan
(Number left, Number right) static boolean
operator_lessEqualsThan
(QuantityType<?> x, Number y) static boolean
operator_lessEqualsThan
(QuantityType<?> x, QuantityType<?> y) static boolean
operator_lessEqualsThan
(Type type, Number x) static boolean
operator_lessThan
(Number left, Number right) static boolean
operator_lessThan
(QuantityType<?> x, Number y) static boolean
operator_lessThan
(QuantityType<?> x, QuantityType<?> y) static boolean
operator_lessThan
(Type type, Number x) static BigDecimal
static BigDecimal
operator_minus
(Number x, Number y) static QuantityType
<?> operator_minus
(QuantityType<?> x) static QuantityType
<?> operator_minus
(QuantityType<?> x, QuantityType<?> y) static BigDecimal
operator_multiply
(Number x, Number y) static QuantityType
<?> operator_multiply
(Number x, QuantityType<?> y) static QuantityType
<?> operator_multiply
(QuantityType<?> x, Number y) static QuantityType
<?> operator_multiply
(QuantityType<?> x, QuantityType<?> y) static boolean
operator_notEquals
(Number left, Number right) static boolean
operator_notEquals
(QuantityType<?> left, Number right) static boolean
operator_notEquals
(QuantityType<?> left, QuantityType<?> right) static boolean
operator_notEquals
(Type type, Number x) static BigDecimal
operator_plus
(Number x, Number y) static QuantityType
<?> operator_plus
(QuantityType<?> x, QuantityType<?> y)
-
Field Details
-
NULL_DEFINITION
It is the definition of Java null pointer for the rules language. Actually its value is 0 (rules variables are number) but we can use the null pointer and throws an NPE when a null value is used. I think this concept should not exist for those who writes the rules.
-
-
Constructor Details
-
NumberExtensions
public NumberExtensions()
-
-
Method Details
-
operator_plus
-
operator_minus
-
operator_minus
-
operator_multiply
-
operator_divide
-
operator_equals
-
operator_notEquals
-
operator_lessThan
-
operator_greaterThan
-
operator_lessEqualsThan
-
operator_greaterEqualsThan
-
operator_equals
-
operator_notEquals
-
operator_greaterThan
-
operator_greaterEqualsThan
-
operator_lessThan
-
operator_lessEqualsThan
-
operator_plus
-
operator_minus
-
operator_minus
-
operator_multiply
-
operator_multiply
-
operator_multiply
-
operator_divide
-
operator_divide
-
operator_divide
-
operator_equals
-
operator_equals
-
operator_notEquals
-
operator_notEquals
-
operator_lessThan
-
operator_lessThan
-
operator_lessEqualsThan
-
operator_lessEqualsThan
-
operator_greaterThan
-
operator_greaterThan
-
operator_greaterEqualsThan
-
operator_greaterEqualsThan
-
numberToBigDecimal
Convert the given number into a BigDecimal- Parameters:
number
- the number to convert- Returns:
- the given number as BigDecimal or null if number is null
-