Search in sources :

Example 1 with AbstractTupleCalc

use of mondrian.calc.impl.AbstractTupleCalc in project mondrian by pentaho.

the class NamedSetCurrentFunDef method compileCall.

public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) {
    final Exp arg0 = call.getArg(0);
    assert arg0 instanceof NamedSetExpr : "checked this in createCall";
    final NamedSetExpr namedSetExpr = (NamedSetExpr) arg0;
    if (arg0.getType().getArity() == 1) {
        return new AbstractMemberCalc(call, new Calc[0]) {

            public Member evaluateMember(Evaluator evaluator) {
                return namedSetExpr.getEval(evaluator).currentMember();
            }
        };
    } else {
        return new AbstractTupleCalc(call, new Calc[0]) {

            public Member[] evaluateTuple(Evaluator evaluator) {
                return namedSetExpr.getEval(evaluator).currentTuple();
            }
        };
    }
}
Also used : AbstractTupleCalc(mondrian.calc.impl.AbstractTupleCalc) NamedSetExpr(mondrian.mdx.NamedSetExpr) AbstractMemberCalc(mondrian.calc.impl.AbstractMemberCalc)

Aggregations

AbstractMemberCalc (mondrian.calc.impl.AbstractMemberCalc)1 AbstractTupleCalc (mondrian.calc.impl.AbstractTupleCalc)1 NamedSetExpr (mondrian.mdx.NamedSetExpr)1