Class AggregationFunctionAdapter
java.lang.Object
nz.org.riskscape.engine.function.agg.AggregationFunctionAdapter
- All Implemented Interfaces:
AutoCloseable,RiskscapeFunction,UntypedFunction,RealizableFunction
public class AggregationFunctionAdapter
extends Object
implements RiskscapeFunction, RealizableFunction
Adapts an AggregationFunction so that it can be called in a standard RealizedExpression.
Supports only single argument functions, but could be extended to support more complex configurations
-
Nested Class Summary
Nested classes/interfaces inherited from interface nz.org.riskscape.engine.rl.RealizableFunction
RealizableFunction.MetadataIdentifiedRealizableFunction -
Field Summary
Fields inherited from interface nz.org.riskscape.engine.function.RiskscapeFunction
BUILT_IN, LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExecute the function with the given arguments.realize(RealizationContext context, FunctionCall functionCall, List<Type> argumentTypes) Attempt to adapt a function call to the given types.Methods 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
isDoTypeAdaptationMethods inherited from interface nz.org.riskscape.engine.function.RiskscapeFunction
builtin, close, getOverloaded, getRealizable, getTypesFromArguments, identified, identified, isA, setProblemReporter, validate
-
Constructor Details
-
AggregationFunctionAdapter
-
-
Method Details
-
getReturnType
- Specified by:
getReturnTypein interfaceRiskscapeFunction- Returns:
- the type that this function should return
-
getArguments
- Specified by:
getArgumentsin interfaceRiskscapeFunction
-
getArgumentTypes
- Specified by:
getArgumentTypesin interfaceRiskscapeFunction- Returns:
- the types that this function expects
-
call
Description copied from interface:UntypedFunctionExecute the function with the given arguments.
- Specified by:
callin interfaceUntypedFunction- Parameters:
args- list of arguments to the function that should conform to the types inArgumentList.getArgumentTypes()
-
getAggregationFunction
- Specified by:
getAggregationFunctionin interfaceRiskscapeFunction- Returns:
- An
AggregationFunctionthat is functionally the same operation as this, but works with aRealizedAggregateExpression, rather than against aRealizedExpressionwith anRSList.
-
realize
public ResultOrProblems<RiskscapeFunction> realize(RealizationContext context, FunctionCall functionCall, List<Type> argumentTypes) Description copied from interface:RealizableFunctionAttempt to adapt a function call to the given types. This can also be used to do constant optimizations etc or anything else.
- Specified by:
realizein interfaceRealizableFunctionfunctionCall- the part of the abstract syntax tree for the function callargumentTypes- the types of the arguments that have been supplied to the function- Returns:
- the adapted function, or some problems if it couldn't be adapted.
-