Class SpatialFunction<R>
java.lang.Object
org.apache.sis.internal.filter.Node
org.apache.sis.internal.filter.sqlmm.SpatialFunction<R>
- Type Parameters:
R
- the type of resources (e.g.Feature
) used as inputs.
- All Implemented Interfaces:
Serializable
,Function<R,
,Object> Expression<R,
,Object> Optimization.OnExpression<R,
,Object> FeatureExpression<R,
Object>
- Direct Known Subclasses:
FunctionWithSRID
,OneGeometry
,TwoGeometries
abstract class SpatialFunction<R>
extends Node
implements FeatureExpression<R,Object>, Optimization.OnExpression<R,Object>
Base class of SQLMM spatial functions.
- Since:
- 1.1
- Version:
- 1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionAll operation names asScopedName
instances.(package private) final SQLMM
Identification of the SQLMM operation.private static final org.opengis.util.LocalName
Scope of all names defined by SQLMM standard.private static final long
For cross-version compatibility. -
Constructor Summary
ConstructorsConstructorDescriptionSpatialFunction
(SQLMM operation, Expression<? super R, ?>[] parameters) Creates a new function. -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.opengis.util.ScopedName
createName
(SQLMM operation) Invoked bygetFunctionName()
when a name needs to be created.expectedType
(DefaultFeatureType valueType, FeatureTypeBuilder addTo) Provides the type of values produced by this expression when a feature of the given type is evaluated.protected final Collection
<?> Returns the children of this node, which are the parameters list.final org.opengis.util.ScopedName
Returns the name of the function to be called.(package private) abstract Geometries
<?> Returns a handler for the library of geometric objects used by this expression.Returns a Backus-Naur Form (BNF) of this function.final Class
<?> Returns the kind of objects evaluated by this expression.final <N> Expression
<R, N> toValueType
(Class<N> target) Returnsthis
if this expression provides values of the specified type, or throws an exception otherwise.Methods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, 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.Expression
apply, getParameters
Methods inherited from interface org.apache.sis.filter.Optimization.OnExpression
optimize, recreate
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
SCOPE
private static final org.opengis.util.LocalName SCOPEScope of all names defined by SQLMM standard.- See Also:
-
operation
Identification of the SQLMM operation. -
NAMES
All operation names asScopedName
instances. Values are created when first needed.
-
-
Constructor Details
-
SpatialFunction
SpatialFunction(SQLMM operation, Expression<? super R, ?>[] parameters) Creates a new function. This constructor verifies that the number of parameters is betweenSQLMM.minParamCount
andSQLMM.maxParamCount
inclusive, but does not store the parameters. Parameters shall be stored by subclasses.- Parameters:
operation
- identification of the SQLMM operation.parameters
- sub-expressions that will be evaluated to provide the parameters to the function.- Throws:
IllegalArgumentException
- if the number of parameters is not in the expected range.
-
-
Method Details
-
getGeometryLibrary
Returns a handler for the library of geometric objects used by this expression. This is typically implemented by a call togetGeometryLibrary(geometry)
wheregeometry
as the first expression returning a geometry object.- Returns:
- the geometry library (never
null
). - See Also:
-
getFunctionName
public final org.opengis.util.ScopedName getFunctionName()Returns the name of the function to be called. This method returns a scoped name with theSQLMM
function name in the local part.- Specified by:
getFunctionName
in interfaceExpression<R,
Object> - Returns:
- name of the function to be called.
-
createName
Invoked bygetFunctionName()
when a name needs to be created. -
getChildren
Returns the children of this node, which are the parameters list. This is used for information purpose only, for example in order to build a string representation.- Specified by:
getChildren
in classNode
- Returns:
- the children of this node.
-
getSyntax
Returns a Backus-Naur Form (BNF) of this function. -
getValueClass
Returns the kind of objects evaluated by this expression.- Specified by:
getValueClass
in interfaceFeatureExpression<R,
Object> - Returns:
- the type of values computed by this expression.
-
toValueType
Returnsthis
if this expression provides values of the specified type, or throws an exception otherwise.- Specified by:
toValueType
in interfaceExpression<R,
Object> - Type Parameters:
N
- compile-time value oftype
.- Parameters:
target
- desired type of expression results.- Returns:
- expression doing the same operation this this expression but with results of the specified type.
-
expectedType
Provides the type of values produced by this expression when a feature of the given type is evaluated. There are two cases:- If the operation expects at least one geometric parameter and returns a geometry, then the characteristics of the first parameter (in particular the CRS) are copied. The first parameter is used as a template for compliance with SQLMM specification.
- Otherwise an attribute is created with the return value specified by the operation.
- Specified by:
expectedType
in interfaceFeatureExpression<R,
Object> - Parameters:
valueType
- the type of features on which to apply this expression.addTo
- where to add the type of properties evaluated by this expression.- Returns:
- builder of type resulting from expression evaluation (never null).
- Throws:
IllegalArgumentException
- if the given feature type does not contain the expected properties, or if this method cannot determine the result type of the expression. It may be because that expression is backed by an unsupported implementation.
-