Package com.singularsys.jep.misc.nullwrapper
package com.singularsys.jep.misc.nullwrapper
Package to allow the treatment of null values which propagate up through evaluation so that
null op anything
will be null
for most operator. This is similar behaviour SQL with its
three value logic.
The package works by wrapping existing operators and functions in new operators and functions
which will propagate null values.
To set up this functionality use
jep.setComponent(new NullWrappedOperatorTable((OperatorTable2) jep.getOperatorTable(),true)); jep.setComponent(new NullWrappedFunctionTable(jep.getFunctionTable())); jep.setComponent(new StandardConfigurableParser()); ((FastEvaluator) jep.getEvaluator()).setTrapNullValues(false); ((FastEvaluator)jep.getEvaluator()).setTrapUnsetValues(false);
This will include the standard set of operators and functions as well as
a Null-safe equals operator <=>
.
The logic operators are exceptions to the general rule, true || null
A OR B | True | False | null |
---|---|---|---|
True | True | True | True |
False | True | False | null |
null | True | null | null |
A AND B | True | False | null |
---|---|---|---|
True | True | False | null |
False | False | False | False |
null | null | False | null |
A | NOT A |
---|---|
True | False |
False | True |
null | null |
-
ClassDescriptionA factory to create the appropriate type of wrapped function.A function table which wraps all the functions in an existing table.An operator table where the operators generally return null if either argument is null.Key for the one operator NullSafeEquals added by the table.