Package mondrian.calc

Interface ExpCompiler

All Known Implementing Classes:
AbstractExpCompiler, BetterExpCompiler, DelegatingExpCompiler

public interface ExpCompiler
Mediates the compilation of an expression (Exp) into a compiled expression (Calc).
Since:
Sep 28, 2005
Author:
jhyde
  • Method Details

    • getEvaluator

      Evaluator getEvaluator()
      Returns the evaluator to be used for evaluating expressions during the compilation process.
    • getValidator

      Validator getValidator()
      Returns the validator which was used to validate this expression.
      Returns:
      validator
    • compile

      Calc compile(Exp exp)
      Compiles an expression.
      Parameters:
      exp - Expression
      Returns:
      Compiled expression
    • compileAs

      Calc compileAs(Exp exp, Type resultType, List<ResultStyle> preferredResultStyles)
      Compiles an expression to a given result type.

      If resultType is not null, casts the expression to that type. Throws an exception if that conversion is not allowed by the type system.

      The preferredResultStyles parameter specifies a list of desired result styles. It must not be null, but may be empty.

      Parameters:
      exp - Expression
      resultType - Desired result type, or null to use expression's current type
      preferredResultStyles - List of result types, in descending order of preference. Never null.
      Returns:
      Compiled expression, or null if none can satisfy
    • compileMember

      MemberCalc compileMember(Exp exp)
      Compiles an expression which yields a Member result.
    • compileLevel

      LevelCalc compileLevel(Exp exp)
      Compiles an expression which yields a Level result.
    • compileDimension

      DimensionCalc compileDimension(Exp exp)
      Compiles an expression which yields a Dimension result.
    • compileHierarchy

      HierarchyCalc compileHierarchy(Exp exp)
      Compiles an expression which yields a Hierarchy result.
    • compileInteger

      IntegerCalc compileInteger(Exp exp)
      Compiles an expression which yields an int result. The expression is implicitly converted into a scalar.
    • compileString

      StringCalc compileString(Exp exp)
      Compiles an expression which yields a String result. The expression is implicitly converted into a scalar.
    • compileDateTime

      DateTimeCalc compileDateTime(Exp exp)
      Compiles an expression which yields a Date result. The expression is implicitly converted into a scalar.
    • compileList

      ListCalc compileList(Exp exp)
      Compiles an expression which yields an immutable TupleList result.

      Always equivalent to compileList(mondrian.olap.Exp)(exp, false).

    • compileList

      ListCalc compileList(Exp exp, boolean mutable)
      Compiles an expression which yields TupleList result.

      Such an expression is generally a list of Member objects or a list of tuples (each represented by a Member array).

      See compileList(mondrian.olap.Exp).

      Parameters:
      exp - Expression
      mutable - Whether resulting list is mutable
    • compileIter

      IterCalc compileIter(Exp exp)
      Compiles an expression which yields an immutable Iterable result.
      Parameters:
      exp - Expression
      Returns:
      Calculator which yields an Iterable
    • compileBoolean

      BooleanCalc compileBoolean(Exp exp)
      Compiles an expression which yields a boolean result.
      Parameters:
      exp - Expression
      Returns:
      Calculator which yields a boolean
    • compileDouble

      DoubleCalc compileDouble(Exp exp)
      Compiles an expression which yields a double result.
      Parameters:
      exp - Expression
      Returns:
      Calculator which yields a double
    • compileTuple

      TupleCalc compileTuple(Exp exp)
      Compiles an expression which yields a tuple result.
      Parameters:
      exp - Expression
      Returns:
      Calculator which yields a tuple
    • compileScalar

      Calc compileScalar(Exp exp, boolean specific)
      Compiles an expression to yield a scalar result.

      If the expression yields a member or tuple, the calculator will automatically apply that member or tuple to the current dimensional context and return the value of the current measure.

      Parameters:
      exp - Expression
      specific - Whether to try to use the specific compile method for scalar types. For example, if specific is true and exp is a string expression, calls compileString(mondrian.olap.Exp)
      Returns:
      Calculation which returns the scalar value of the expression
    • registerParameter

      ParameterSlot registerParameter(Parameter parameter)
      Implements a parameter, returning a unique slot which will hold the parameter's value.
      Parameters:
      parameter - Parameter
      Returns:
      Slot
    • getAcceptableResultStyles

      List<ResultStyle> getAcceptableResultStyles()
      Returns a list of the ResultStyles acceptable to the caller.