Search in sources :

Example 1 with RolapMember

use of mondrian.rolap.RolapMember in project mondrian by pentaho.

the class RangeFunDef method compileMembers.

/**
 * Returns two membercalc objects, substituting nulls with the hierarchy
 * null member of the other expression.
 *
 * @param exp0 first expression
 * @param exp1 second expression
 *
 * @return two member calcs
 */
private MemberCalc[] compileMembers(Exp exp0, Exp exp1, ExpCompiler compiler) {
    MemberCalc[] members = new MemberCalc[2];
    if (exp0.getType() instanceof NullType) {
        members[0] = null;
    } else {
        members[0] = compiler.compileMember(exp0);
    }
    if (exp1.getType() instanceof NullType) {
        members[1] = null;
    } else {
        members[1] = compiler.compileMember(exp1);
    }
    if (members[0] == null && members[1] == null) {
        throw MondrianResource.instance().TwoNullsNotSupported.ex();
    } else if (members[0] == null) {
        Member nullMember = ((RolapMember) members[1].evaluate(null)).getHierarchy().getNullMember();
        members[0] = (MemberCalc) ConstantCalc.constantMember(nullMember);
    } else if (members[1] == null) {
        Member nullMember = ((RolapMember) members[0].evaluate(null)).getHierarchy().getNullMember();
        members[1] = (MemberCalc) ConstantCalc.constantMember(nullMember);
    }
    return members;
}
Also used : RolapMember(mondrian.rolap.RolapMember) NullType(mondrian.olap.type.NullType) RolapMember(mondrian.rolap.RolapMember)

Aggregations

NullType (mondrian.olap.type.NullType)1 RolapMember (mondrian.rolap.RolapMember)1