Search in sources :

Example 1 with NamedSetExpr

use of mondrian.mdx.NamedSetExpr in project mondrian by pentaho.

the class NamedSetCurrentOrdinalFunDef 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;
    return new AbstractIntegerCalc(call, new Calc[0]) {

        public int evaluateInteger(Evaluator evaluator) {
            return namedSetExpr.getEval(evaluator).currentOrdinal();
        }
    };
}
Also used : NamedSetExpr(mondrian.mdx.NamedSetExpr) AbstractIntegerCalc(mondrian.calc.impl.AbstractIntegerCalc)

Example 2 with NamedSetExpr

use of mondrian.mdx.NamedSetExpr 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

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