Package org.apache.sis.filter
Class ArithmeticFunction<R>
java.lang.Object
org.apache.sis.internal.filter.Node
org.apache.sis.filter.BinaryFunction<R,Number,Number>
org.apache.sis.filter.ArithmeticFunction<R>
- Type Parameters:
R- the type of resources (e.g.Feature) used as inputs.
- All Implemented Interfaces:
Serializable,Function<R,,Number> Expression<R,,Number> Optimization.OnExpression<R,,Number> FeatureExpression<R,Number>
- Direct Known Subclasses:
ArithmeticFunction.Add,ArithmeticFunction.Divide,ArithmeticFunction.Multiply,ArithmeticFunction.Subtract
abstract class ArithmeticFunction<R>
extends BinaryFunction<R,Number,Number>
implements FeatureExpression<R,Number>, Optimization.OnExpression<R,Number>
Arithmetic operations between two numerical values.
The nature of the operation depends on the subclass.
- Since:
- 1.1
- Version:
- 1.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classThe "Add" (+) expression.(package private) static final classThe "Divide" (÷) expression.(package private) static final classThe "Multiply" (×) expression.(package private) static final classThe "Subtract" (−) expression. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longFor cross-version compatibility.Fields inherited from class org.apache.sis.filter.BinaryFunction
expression1, expression2 -
Constructor Summary
ConstructorsConstructorDescriptionArithmeticFunction(Expression<? super R, ? extends Number> expression1, Expression<? super R, ? extends Number> expression2) Creates a new arithmetic function. -
Method Summary
Modifier and TypeMethodDescriptionfinal NumberEvaluates the expression for producing a result of numeric type.(package private) static DefaultAttributeType<Number>createNumericType(String name) Creates an attribute type for numeric values of the given name.protected abstract DefaultAttributeType<Number>Returns the type of results computed by this arithmetic function.final PropertyTypeBuilderexpectedType(DefaultFeatureType ignored, FeatureTypeBuilder addTo) Provides the type of results computed by this expression.final Class<?>Returns the type of values computed by this expression.<N> Expression<R,N> toValueType(Class<N> target) Returnsthisif this expression provides values of the specified type, or otherwise returns an expression doing conversions on-the-fly.Methods inherited from class org.apache.sis.filter.BinaryFunction
apply, applyAsDecimal, applyAsDouble, applyAsFraction, applyAsInteger, applyAsLong, getChildren, getExpressions, getParametersMethods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, getGeometryLibrary, hashCode, symbol, toGeometryWrapper, toString, unwrap, warningMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sis.filter.Expression
getFunctionName, getParametersMethods inherited from interface org.apache.sis.filter.Optimization.OnExpression
optimize, recreate
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
-
Constructor Details
-
ArithmeticFunction
ArithmeticFunction(Expression<? super R, ? extends Number> expression1, Expression<? super R, ? extends Number> expression2) Creates a new arithmetic function.
-
-
Method Details
-
createNumericType
Creates an attribute type for numeric values of the given name. The attribute is mandatory, unbounded and has no default value.- Parameters:
name- name of the attribute to create.- Returns:
- an attribute of the given name for numbers.
-
expectedType
Returns the type of results computed by this arithmetic function. -
getValueClass
Returns the type of values computed by this expression.- Specified by:
getValueClassin interfaceFeatureExpression<R,Number> - Returns:
- the type of values computed by this expression.
-
expectedType
Provides the type of results computed by this expression. That type depends only on theArithmeticFunctionsubclass and is given byexpectedType().- Specified by:
expectedTypein interfaceFeatureExpression<R,Number> - Parameters:
ignored- the type of features to be evaluated by the given expression.addTo- where to add the type of properties evaluated by this expression.- Returns:
- builder of the added property, or
nullif this method cannot add a property.
-
apply
Evaluates the expression for producing a result of numeric type. This method delegates to one of theapplyAs(…)methods. If noapplyAs(…)implementations can return null values, this this method never returnnull. -
toValueType
Returnsthisif this expression provides values of the specified type, or otherwise returns an expression doing conversions on-the-fly.- Specified by:
toValueTypein interfaceExpression<R,Number> - 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.
- Throws:
ClassCastException- if the specified type is not a supported target type.
-