- java.lang.Object
-
- com.pervasive.datarush.functions.WidestInputTyper
-
- All Implemented Interfaces:
FunctionTyper
public class WidestInputTyper extends Object implements FunctionTyper
A typer determining the output type of a function based on the types of one or more inputs. If more than one input is used, the widest of the inputs is used.
-
-
Constructor Summary
Constructors Constructor Description WidestInputTyper(int... indices)
Defines a type using the specified inputs to determine the output type.WidestInputTyper(ScalarTokenType bound, int... indices)
Defines a type using the specified inputs to determine the output type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScalarTokenType
computeResultType(FunctionContext ctx)
Calculates the result type for the function given the provided context.ScalarTokenType
computeUpperBound(FunctionContext ctx)
Calculates the upper bound for the function given the provided context.
-
-
-
Constructor Detail
-
WidestInputTyper
public WidestInputTyper(int... indices)
Defines a type using the specified inputs to determine the output type.- Parameters:
indices
- the input arguments to use to determine type. If none are supplied, all arguments are used.
-
WidestInputTyper
public WidestInputTyper(ScalarTokenType bound, int... indices)
Defines a type using the specified inputs to determine the output type. The given type is the upper bound on the output type. While this also implies an upper bound on the selected inputs, an explicit bound should also be declared in theScalarFunctionDescriptor
.- Parameters:
bound
- the upper bound for the functionindices
- the input arguments to use to determine type. If none are supplied, all arguments are used.
-
-
Method Detail
-
computeUpperBound
public ScalarTokenType computeUpperBound(FunctionContext ctx)
Description copied from interface:FunctionTyper
Calculates the upper bound for the function given the provided context.The context contains the upper bounds on the types of all arguments to the function. If a argument is not a subclass of
ScalarValuedFunction
, its type isnull
.- Specified by:
computeUpperBound
in interfaceFunctionTyper
- Parameters:
ctx
- the context of the function being processed- Returns:
- the upper bound on the function
-
computeResultType
public ScalarTokenType computeResultType(FunctionContext ctx)
Description copied from interface:FunctionTyper
Calculates the result type for the function given the provided context.The context contains the actual result types of all arguments to the function. If a argument is not a subclass of
ScalarValuedFunction
, its type isnull
.- Specified by:
computeResultType
in interfaceFunctionTyper
- Parameters:
ctx
- the context of the function being processed- Returns:
- the result type of the function
-
-