Package net.objecthunter.exp4j.operator
Class Operators
java.lang.Object
net.objecthunter.exp4j.operator.Operators
This class implements all the built-in operators both arithmetic and
boolean.
Boolean values will be treated as follows:
- if the absolute value is less than 1e-12 it will be considered
false
. About this... I know is not the ideal approach, but we have a LOT of arithmetic "hacks" all around some projects and this behavior is actually expected. - if the absolute value is bigger or equal than 1e-12 it will be considered
true
- the boolean results will always be
1.0
fortrue
and0.0
forfalse
- boolean operations will always have lower precedence than arithmetic operations (i.e. they will be evaluated last)
- The precedence (order) of the boolean operators will always be ¬ &
| (in accordance to the analogy with arithmetic operators), so that:
a & b| b & ¬c -> ((a & b) | (b & (¬c)))
-
Method Summary
Modifier and TypeMethodDescriptionstatic Operator
getBuiltinOperator
(char symbol, int numArguments) Retrieves a Built-in operator.static Operator[]
Array with all the available operators
-
Method Details
-
getBuiltinOperator
Retrieves a Built-in operator.- Parameters:
symbol
- Symbol representing the operatornumArguments
- Number of arguments of the operator- Returns:
- An operator matching the criteria if one exists or
null
otherwise - See Also:
-
getOperators
Array with all the available operators- Returns:
Operator
array- See Also:
-