Class WidestInputTyper

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 Details

    • 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 the ScalarFunctionDescriptor.
      Parameters:
      bound - the upper bound for the function
      indices - the input arguments to use to determine type. If none are supplied, all arguments are used.
  • Method Details

    • 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 is null.

      Specified by:
      computeUpperBound in interface FunctionTyper
      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 is null.

      Specified by:
      computeResultType in interface FunctionTyper
      Parameters:
      ctx - the context of the function being processed
      Returns:
      the result type of the function