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
-
Constructor Summary
-
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, wait
Methods inherited from interface nz.org.riskscape.engine.function.RiskscapeFunction
builtin, getOverloaded, getRealizable, getTypesFromArguments, identified, identified, isA, setProblemReporter, validate
Methods inherited from interface nz.org.riskscape.engine.function.UntypedFunction
close
-
Constructor Details
-
AggregationFunctionAdapter
-
-
Method Details
-
getReturnType
- Specified by:
getReturnType
in interfaceRiskscapeFunction
- Returns:
- the type that this function should return
-
getArguments
- Specified by:
getArguments
in interfaceRiskscapeFunction
-
getArgumentTypes
- Specified by:
getArgumentTypes
in interfaceRiskscapeFunction
- Returns:
- the types that this function expects
-
call
Description copied from interface:UntypedFunction
Execute the function with the given arguments.
- Specified by:
call
in interfaceUntypedFunction
- Parameters:
args
- list of arguments to the function that should conform to the types inArgumentList.getArgumentTypes()
-
getAggregationFunction
- Specified by:
getAggregationFunction
in interfaceRiskscapeFunction
- Returns:
- An
AggregationFunction
that is functionally the same operation as this, but works with aRealizedAggregateExpression
, rather than against aRealizedExpression
with anRSList
.
-
realize
public ResultOrProblems<RiskscapeFunction> realize(RealizationContext context, FunctionCall functionCall, List<Type> argumentTypes) Description copied from interface:RealizableFunction
Attempt to adapt a function call to the given types. This can also be used to do constant optimizations etc or anything else.
- Specified by:
realize
in interfaceRealizableFunction
functionCall
- 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.
-