Class BooleanExpressionSplitter
Utility allowing boolean yielding expressions to be realized against a Struct
type that may
not contain all referenced properties.
Important to not that returned expression may have parts of the expression removed. It is important that the full expression be applied to achieve the desired filtering.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.RealizedExpression>
splitAndRealize
(nz.org.riskscape.rl.ast.Expression expression, nz.org.riskscape.engine.types.Struct inputType, nz.org.riskscape.engine.rl.ExpressionRealizer expressionRealizer) Reduces boolean expressions so they can be applied to inputType allowing as much filtering to be applied as possible.
-
Constructor Details
-
BooleanExpressionSplitter
public BooleanExpressionSplitter()
-
-
Method Details
-
splitAndRealize
public static nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.RealizedExpression> splitAndRealize(nz.org.riskscape.rl.ast.Expression expression, nz.org.riskscape.engine.types.Struct inputType, nz.org.riskscape.engine.rl.ExpressionRealizer expressionRealizer) Reduces boolean expressions so they can be applied to inputType allowing as much filtering to be applied as possible.
Any expression segments that access properties not contained in inputType will be removed. This may also remove expression segments to do exist where these could affect the results, eg 'known.attr OR unknown.attr' would result in no expression being realized.
The resulting expression may be used to reduce data but it is important that the full boolean expression is applied to the whole data set to ensure correct results.
- Parameters:
expression
- to splitinputType
- type expression will be applied toexpressionRealizer
- realizer of expressions- Returns:
- realized expression for properties found in input type
-