}
public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) {
// Member defaults to [Time].currentmember
Exp[] args = call.getArgs();
final MemberCalc memberCalc;
if (args.length == 1) {
final RolapHierarchy timeHierarchy =
((RolapCube) compiler.getEvaluator().getCube())
.getTimeHierarchy(getName());
memberCalc =
new HierarchyCurrentMemberFunDef.FixedCalcImpl(
call, timeHierarchy);
} else {
memberCalc = compiler.compileMember(args[1]);
}
// Numeric Expression.
final IntegerCalc indexValueCalc =
compiler.compileInteger(args[0]);
return new AbstractListCalc(
call, new Calc[] {memberCalc, indexValueCalc})
{
public List evaluateList(Evaluator evaluator) {
Member member = memberCalc.evaluateMember(evaluator);
int indexValue = indexValueCalc.evaluateInteger(evaluator);
return lastPeriods(member, evaluator, indexValue);
}
};