public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) {
if (call.getArgCount() > 2) {
throw MondrianResource.instance()
.ToggleDrillStateRecursiveNotSupported.ex();
}
final ListCalc listCalc0 =
compiler.compileList(call.getArg(0));
final ListCalc listCalc1 =
compiler.compileList(call.getArg(1));
if (((SetType) call.getType()).getArity() == 1) {
return new AbstractListCalc(call, new Calc[] {listCalc0, listCalc1})
{
public List evaluateList(Evaluator evaluator) {
final List<Member> list0 =
listCalc0.evaluateList(evaluator);
final List<Member> list1 =
listCalc1.evaluateList(evaluator);
return toggleDrillStateMembers(evaluator, list0, list1);
}
};
} else {
return new AbstractListCalc(call, new Calc[] {listCalc0, listCalc1})
{
public List evaluateList(Evaluator evaluator) {
final List<Member[]> list0 =
listCalc0.evaluateList(evaluator);
final List<Member> list1 =
listCalc1.evaluateList(evaluator);
return toggleDrillStateTuples(evaluator, list0, list1);
}
};
}
}