Class GeometryPredicateFunction

java.lang.Object
nz.org.riskscape.engine.function.BaseRealizableFunction
nz.org.riskscape.engine.function.GeometryPredicateFunction
All Implemented Interfaces:
nz.org.riskscape.engine.rl.RealizableFunction

public class GeometryPredicateFunction extends BaseRealizableFunction
  • Nested Class Summary

    Nested classes/interfaces inherited from interface nz.org.riskscape.engine.rl.RealizableFunction

    nz.org.riskscape.engine.rl.RealizableFunction.MetadataIdentifiedRealizableFunction
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final nz.org.riskscape.engine.function.ArgumentList
     

    Fields inherited from class nz.org.riskscape.engine.function.BaseRealizableFunction

    arguments, returnType
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    GeometryPredicateFunction(BiPredicate<org.locationtech.jts.geom.Geometry,org.locationtech.jts.geom.Geometry> predicate)
     
    protected
    GeometryPredicateFunction(nz.org.riskscape.engine.function.FunctionArgument... extraArgs)
    For use by subclasses that wish to supply a custom predicate at runtime.
  • Method Summary

    Modifier and Type
    Method
    Description
    BiPredicate<org.locationtech.jts.geom.Geometry,org.locationtech.jts.geom.Geometry>
     
    nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.function.RiskscapeFunction>
    realize(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall functionCall, List<nz.org.riskscape.engine.types.Type> argTypes)
    Implements some basic boilerplate error checks by default.
    protected Function<List<Object>,BiPredicate<org.locationtech.jts.geom.Geometry,org.locationtech.jts.geom.Geometry>>
    realizePredicateSupplier(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall functionCall, List<nz.org.riskscape.engine.types.Type> argTypes)
    Realize the predicate supplier.

    Methods inherited from class nz.org.riskscape.engine.function.BaseRealizableFunction

    asFunction, build, builtin, getArguments, getReturnType, identified

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BASE_ARGUMENTS

      protected static final nz.org.riskscape.engine.function.ArgumentList BASE_ARGUMENTS
  • Constructor Details

    • GeometryPredicateFunction

      public GeometryPredicateFunction(BiPredicate<org.locationtech.jts.geom.Geometry,org.locationtech.jts.geom.Geometry> predicate)
    • GeometryPredicateFunction

      protected GeometryPredicateFunction(nz.org.riskscape.engine.function.FunctionArgument... extraArgs)

      For use by subclasses that wish to supply a custom predicate at runtime. These subclasses must override realizePredicateSupplier(RealizationContext, FunctionCall, List) to allow the predicate to obtained when required

      Parameters:
      extraArgs - the in addition to BASE_ARGUMENTS that the function requires
  • Method Details

    • realize

      public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.function.RiskscapeFunction> realize(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall functionCall, List<nz.org.riskscape.engine.types.Type> argTypes)
      Description copied from class: BaseRealizableFunction

      Implements some basic boilerplate error checks by default. This allows simple realizable functions to just define the BaseRealizableFunction.build(RealizationContext, FunctionCall, List) guts of the function. More complicated realizable functions (i.e. with non-trivial type handling) may want to override this completely.

      Specified by:
      realize in interface nz.org.riskscape.engine.rl.RealizableFunction
      Overrides:
      realize in class BaseRealizableFunction
    • realizePredicateSupplier

      protected Function<List<Object>,BiPredicate<org.locationtech.jts.geom.Geometry,org.locationtech.jts.geom.Geometry>> realizePredicateSupplier(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall functionCall, List<nz.org.riskscape.engine.types.Type> argTypes) throws nz.org.riskscape.problem.ProblemException

      Realize the predicate supplier.

      May be used by sub classes to customise how a predicate function is supplied.

      Parameters:
      context - the realization context
      functionCall - the function call AST being realized
      argTypes - the types of the arguments that have been supplied to the function
      Returns:
      a function that given the functions arguments will return a geometry bi predicate function
      Throws:
      nz.org.riskscape.problem.ProblemException - should argTypes or functionCall contain problems
    • getPredicate

      public BiPredicate<org.locationtech.jts.geom.Geometry,org.locationtech.jts.geom.Geometry> getPredicate()