Package nz.org.riskscape.engine.function
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface nz.org.riskscape.engine.rl.RealizableFunction
nz.org.riskscape.engine.rl.RealizableFunction.MetadataIdentifiedRealizableFunction
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final nz.org.riskscape.engine.function.ArgumentList
Fields inherited from class nz.org.riskscape.engine.function.BaseRealizableFunction
arguments, returnType
-
Constructor Summary
ModifierConstructorDescriptionGeometryPredicateFunction
(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 TypeMethodDescriptionBiPredicate<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
-
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 toBASE_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 interfacenz.org.riskscape.engine.rl.RealizableFunction
- Overrides:
realize
in classBaseRealizableFunction
-
realizePredicateSupplier
protected Function<List<Object>,BiPredicate<org.locationtech.jts.geom.Geometry, realizePredicateSupplierorg.locationtech.jts.geom.Geometry>> (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 contextfunctionCall
- the function call AST being realizedargTypes
- 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()
-