Package nz.org.riskscape.engine.rl
Class DefaultOperators
java.lang.Object
nz.org.riskscape.engine.rl.DefaultOperators
- All Implemented Interfaces:
nz.org.riskscape.engine.function.OperatorResolver
public class DefaultOperators
extends Object
implements nz.org.riskscape.engine.function.OperatorResolver
Core set of functions that work with the default types in RiskScape - should cover most of what ECQL does.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final EnumSet<nz.org.riskscape.rl.TokenTypes>
static final EnumSet<nz.org.riskscape.rl.TokenTypes>
static final EnumSet<nz.org.riskscape.rl.TokenTypes>
static final DefaultOperators
static final Map<nz.org.riskscape.rl.TokenTypes,
List<nz.org.riskscape.engine.function.RiskscapeFunction>> static final EnumSet<nz.org.riskscape.rl.TokenTypes>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> nz.org.riskscape.engine.function.RiskscapeFunction
operatorFor
(nz.org.riskscape.rl.TokenTypes operationToken, Class<T> javaType, BinaryOperator<T> function) nz.org.riskscape.engine.function.RiskscapeFunction
orFunction
(boolean nullableInputs) Returns aRiskscapeFunction
implementing OR logic.<T> nz.org.riskscape.engine.function.RiskscapeFunction
predicateFor
(nz.org.riskscape.rl.TokenTypes operator, Class<T> javaType, BiPredicate<T, T> predicate) Optional<nz.org.riskscape.engine.function.RiskscapeFunction>
resolve
(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.BinaryOperation operation, nz.org.riskscape.engine.types.Type inputType, nz.org.riskscape.engine.types.Type lhs, nz.org.riskscape.engine.types.Type rhs)
-
Field Details
-
MATHS_OPERATORS
-
BOOLEAN_COMPARATORS
-
EQUALITY_OPERATORS
-
BOOLEAN_LOGIC_OPERATORS
-
MATHS_FUNCTIONS
-
INSTANCE
-
-
Constructor Details
-
DefaultOperators
public DefaultOperators()
-
-
Method Details
-
predicateFor
public <T> nz.org.riskscape.engine.function.RiskscapeFunction predicateFor(nz.org.riskscape.rl.TokenTypes operator, Class<T> javaType, BiPredicate<T, T> predicate) -
orFunction
public nz.org.riskscape.engine.function.RiskscapeFunction orFunction(boolean nullableInputs) Returns a
RiskscapeFunction
implementing OR logic.If nullableInputs is true, then an exception to the any null input returns null rule (refer to
NullSafeFunction
) is made and true/false is returned as long as one of the arguments is not null. If both arguments are null then null is returned.The function returned by this method should not be wrapped in a
NullSafeFunction
as that will change the OR logic behaviour with one null argument.- Parameters:
nullableInputs
- indicates if either input could be null- Returns:
- or function
-
operatorFor
public static <T> nz.org.riskscape.engine.function.RiskscapeFunction operatorFor(nz.org.riskscape.rl.TokenTypes operationToken, Class<T> javaType, BinaryOperator<T> function) -
resolve
public Optional<nz.org.riskscape.engine.function.RiskscapeFunction> resolve(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.BinaryOperation operation, nz.org.riskscape.engine.types.Type inputType, nz.org.riskscape.engine.types.Type lhs, nz.org.riskscape.engine.types.Type rhs) - Specified by:
resolve
in interfacenz.org.riskscape.engine.function.OperatorResolver
-