Package net.objecthunter.exp4j.extras
Class FunctionsBoolean
java.lang.Object
net.objecthunter.exp4j.extras.FunctionsBoolean
This class contains a set of commonly used boolean functions and constants.
The boolean value rules are the same the we use in the operators:
- if the absolute value is less than
Operator.BOOLEAN_THRESHOLD
it will be consideredfalse
. - if the absolute value is bigger or equal than
Operator.BOOLEAN_THRESHOLD
it will be consideredtrue
- the recommended approach is to use functions or operators that return
boolean values, like the comparison operators or the
TRUE
andFALSE
constants - the
TRUE
constant will always return 1.0 andFALSE
will always return 0.0
- Since:
- 0.6-riddler
- Author:
- Federico Vera <[email protected]>
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Function
Logical functionAND
static final Function
Boolean valuefalse
->0.0
.static final Function
Logical functionNAND
static final Function
Logical functionNOR
static final Function
Logical functionNOT
static final Function
Logical functionOR
static final Function
Boolean valuetrue
->1.0
.static final Function
Logical functionXNOR
static final Function
Logical functionXOR
-
Method Summary
Modifier and TypeMethodDescriptionstatic Function
getFunction
(String name) Get the function for a given namestatic Function[]
Array with all the available functions
-
Field Details
-
NOT
Logical functionNOT
a | ~a --+-- 0 | 1 1 | 0
- Since:
- 0.6-riddler
- See Also:
-
Operators.NOT
-
AND
Logical functionAND
a | b | a&b --+---+---- 0 | 0 | 0 0 | 1 | 0 1 | 0 | 0 1 | 1 | 1
- Since:
- 0.6-riddler
- See Also:
-
Operators.AND
-
OR
Logical functionOR
a | b | a|b --+---+---- 0 | 0 | 0 0 | 1 | 1 1 | 0 | 1 1 | 1 | 1
- Since:
- 0.6-riddler
- See Also:
-
Operators.OR
-
XOR
Logical functionXOR
a | b | a^b --+---+---- 0 | 0 | 0 0 | 1 | 1 1 | 0 | 1 1 | 1 | 0
- Since:
- 0.6-riddler
-
NAND
Logical functionNAND
a | b | !(a&b) --+---+------- 0 | 0 | 1 0 | 1 | 1 1 | 0 | 1 1 | 1 | 0
- Since:
- 0.6-riddler
-
NOR
Logical functionNOR
a | b | !(a|b) --+---+------- 0 | 0 | 1 0 | 1 | 0 1 | 0 | 0 1 | 1 | 1
- Since:
- 0.6-riddler
-
XNOR
Logical functionXNOR
a | b | !(a^b) --+---+------- 0 | 0 | 1 0 | 1 | 0 1 | 0 | 0 1 | 1 | 1
- Since:
- 0.6-riddler
-
FALSE
Boolean valuefalse
->0.0
.- Since:
- 0.6-riddler
-
TRUE
Boolean valuetrue
->1.0
.- Since:
- 0.6-riddler
-
-
Method Details
-
getFunctions
Array with all the available functions -
getFunction
Get the function for a given name
-