- java.lang.Object
-
- com.pervasive.datarush.functions.FixedType
-
- All Implemented Interfaces:
FunctionTyper
public class FixedType extends Object implements FunctionTyper
A typer for functions which return a fixed, known type.
-
-
Constructor Summary
Constructors Constructor Description FixedType(ScalarTokenType type)
Creates a typer which always returns the given 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
-
FixedType
public FixedType(ScalarTokenType type)
Creates a typer which always returns the given type.- Parameters:
type
- the return type of the function. This must not be an abstract type.- Throws:
IllegalArgumentException
- if the type is not a valid return type for functions
-
-
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
-
-