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
FieldsModifier and TypeFieldDescriptionprotected static final nz.org.riskscape.engine.function.ArgumentListFields inherited from class nz.org.riskscape.engine.function.BaseRealizableFunction
arguments, returnType -
Constructor Summary
ConstructorsModifierConstructorDescriptionGeometryPredicateFunction(BiPredicate<org.locationtech.jts.geom.Geometry, org.locationtech.jts.geom.Geometry> predicate) protectedGeometryPredicateFunction(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, identifiedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nz.org.riskscape.engine.rl.RealizableFunction
isDoTypeAdaptation
-
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_ARGUMENTSthat 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:BaseRealizableFunctionImplements 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:
realizein interfacenz.org.riskscape.engine.rl.RealizableFunction- Overrides:
realizein 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()
-