Class OpeningClosingPeriodFunDef

  • All Implemented Interfaces:
    FunDef

    class OpeningClosingPeriodFunDef
    extends FunDefBase
    Definition of the OpeningPeriod and ClosingPeriod builtin functions.
    Since:
    2005/8/14
    Author:
    jhyde
    • Field Detail

      • OpeningPeriodResolver

        static final Resolver OpeningPeriodResolver
      • ClosingPeriodResolver

        static final Resolver ClosingPeriodResolver
    • Constructor Detail

      • OpeningClosingPeriodFunDef

        public OpeningClosingPeriodFunDef​(FunDef dummyFunDef,
                                          boolean opening)
    • Method Detail

      • getResultType

        public Type getResultType​(Validator validator,
                                  Exp[] args)
        Description copied from class: FunDefBase
        Returns the type of a call to this function with a given set of arguments.

        The default implementation makes the coarse assumption that the return type is in some way related to the type of the first argument. Operators whose arguments don't follow the requirements of this implementation should override this method.

        If the function definition says it returns a literal type (numeric, string, symbol) then it's a fair guess that the function call returns the same kind of value.

        If the function definition says it returns an object type (cube, dimension, hierarchy, level, member) then we check the first argument of the function. Suppose that the function definition says that it returns a hierarchy, and the first argument of the function happens to be a member. Then it's reasonable to assume that this function returns a member.

        Overrides:
        getResultType in class FunDefBase
        Parameters:
        validator - Validator
        args - Arguments to the call to this operator
        Returns:
        result type of a call this function
      • compileCall

        public Calc compileCall​(ResolvedFunCall call,
                                ExpCompiler compiler)
        Description copied from interface: FunDef
        Converts a call to this function into executable objects.

        The result must implement the appropriate interface for the result type. For example, a function which returns an integer must return an object which implements IntegerCalc.

        Specified by:
        compileCall in interface FunDef
        Overrides:
        compileCall in class FunDefBase
      • getDescendant

        static Member getDescendant​(SchemaReader schemaReader,
                                    Member member,
                                    Level targetLevel,
                                    boolean returnFirstDescendant)
        Returns the first or last descendant of the member at the target level. This method is the implementation of both OpeningPeriod and ClosingPeriod.
        Parameters:
        schemaReader - The schema reader to use to evaluate the function.
        member - The member from which the descendant is to be found.
        targetLevel - The level to stop at.
        returnFirstDescendant - Flag indicating whether to return the first or last descendant of the member.
        Returns:
        A member.
        Pre-condition:
        member.getLevel().getDepth() < level.getDepth();