Package org.apache.sis.filter
Class BinaryGeometryFilter<R,G>
java.lang.Object
org.apache.sis.internal.filter.Node
org.apache.sis.filter.FilterNode<R>
org.apache.sis.filter.BinaryGeometryFilter<R,G>
- Type Parameters:
R
- the type of resources (e.g.Feature
) used as inputs.G
- the implementation type of geometry objects.
- All Implemented Interfaces:
Serializable
,Predicate<R>
,Filter<R>
,Optimization.OnFilter<R>
- Direct Known Subclasses:
BinarySpatialFilter
,DistanceFilter
Base class for filters having two expressions evaluating to geometries.
In addition of 2 geometries, the filter can have additional non-geometric arguments.
The nature of the operation depends on the subclass.
- Since:
- 1.1
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SpatialOperationContext
The preferred CRS and other context to use if geometry transformations are needed.protected final Expression<? super R,
GeometryWrapper<G>> The first of the two expressions to be used by this function.protected final Expression<? super R,
GeometryWrapper<G>> The second of the two expressions to be used by this function.private static final long
For cross-version compatibility. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BinaryGeometryFilter
(Geometries<G> library, Expression<? super R, ?> geometry1, Expression<? super R, ?> geometry2, javax.measure.Unit<?> systemUnit) Creates a new binary function. -
Method Summary
Modifier and TypeMethodDescriptionList<Expression<? super R,
?>> Returns the two expressions used as parameters by this filter.protected abstract boolean
Returns the value to return when a test cannot be applied.optimize
(Optimization optimization) Tries to optimize this filter.protected static <R,
G> Expression<? super R, ?> original
(Expression<R, GeometryWrapper<G>> expression) Returns the original expression specified by the user.protected abstract BinaryGeometryFilter<R,
G> recreate
(Expression<? super R, ?> geometry1, Expression<? super R, ?> geometry2) Recreates a new filter of the same type and with the same parameters, but using the given expressions.Methods inherited from class org.apache.sis.filter.FilterNode
and, negate, or
Methods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, getChildren, getGeometryLibrary, hashCode, symbol, toGeometryWrapper, toString, unwrap, warning
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sis.filter.Filter
getOperatorType, test
Methods inherited from interface org.apache.sis.filter.Optimization.OnFilter
and, negate, or, recreate
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
expression1
The first of the two expressions to be used by this function. -
expression2
The second of the two expressions to be used by this function. -
context
The preferred CRS and other context to use if geometry transformations are needed.
-
-
Constructor Details
-
BinaryGeometryFilter
protected BinaryGeometryFilter(Geometries<G> library, Expression<? super R, ?> geometry1, Expression<? super R, ?> geometry2, javax.measure.Unit<?> systemUnit) Creates a new binary function.- Parameters:
geometry1
- the first of the two expressions to be used by this function.geometry2
- the second of the two expressions to be used by this function.systemUnit
- if the CRS needs to be in some units of measurement, theUnit.getSystemUnit()
value.
-
-
Method Details
-
recreate
protected abstract BinaryGeometryFilter<R,G> recreate(Expression<? super R, ?> geometry1, Expression<? super R, ?> geometry2) Recreates a new filter of the same type and with the same parameters, but using the given expressions. This method is invoked when it is possible to simplify or optimize at least one of the expressions that were given in the original call to the constructor. -
original
protected static <R,G> Expression<? super R,?> original(Expression<R, GeometryWrapper<G>> expression) Returns the original expression specified by the user.- Type Parameters:
R
- the type of resources (e.g.Feature
) used as inputs.G
- the geometry implementation type.- Parameters:
expression
- the expression to unwrap.- Returns:
- the unwrapped expression.
-
getExpressions
Returns the two expressions used as parameters by this filter.- Specified by:
getExpressions
in interfaceFilter<R>
- Returns:
- the expressions used as inputs, or an empty list if none.
-
optimize
Tries to optimize this filter. This method checks if any expression is a literal. If both expressions are literal, we can evaluate immediately. If any expression is a literal and returnsnull
, then the result is known in advance too.- Specified by:
optimize
in interfaceOptimization.OnFilter<R>
- Parameters:
optimization
- the simplifications or optimizations to apply on this filter.- Returns:
- the simplified or optimized filter, or
this
if no optimization has been applied.
-
negativeResult
protected abstract boolean negativeResult()Returns the value to return when a test cannot be applied.
-