Class BooleanExpressionSplitter

java.lang.Object
nz.org.riskscape.engine.rl.BooleanExpressionSplitter

public class BooleanExpressionSplitter extends Object

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 split
      inputType - type expression will be applied to
      expressionRealizer - realizer of expressions
      Returns:
      realized expression for properties found in input type