call.getArgCount() > 2
? compiler.compileInteger(call.getArg(2))
: null;
final int arity = ((SetType) listCalc.getType()).getArity();
if (indexCalc == null) {
return new AbstractListCalc(call, new Calc[] {listCalc, levelCalc})
{
public List evaluateList(Evaluator evaluator) {
List<Member> list = listCalc.evaluateList(evaluator);
if (list.size() == 0) {
return list;
}
int searchDepth = -1;
if (levelCalc != null) {
Level level = levelCalc.evaluateLevel(evaluator);
searchDepth = level.getDepth();
}
return drill(searchDepth, list, evaluator);
}
};
} else if (arity == 1) {
return new AbstractListCalc(call, new Calc[] {listCalc, indexCalc})
{
public List evaluateList(Evaluator evaluator) {
List<Member> list = listCalc.evaluateList(evaluator);
if (list.size() == 0) {
return list;
}
final int index = indexCalc.evaluateInteger(evaluator);
List<Member> result = new ArrayList<Member>();
final SchemaReader schemaReader =
evaluator.getSchemaReader();
for (Member member : list) {
result.add(member);
if (index == 0) {
final List<Member> children =
schemaReader.getMemberChildren(member);
result.addAll(children);
}
}
return result;
}
};
} else {
return new AbstractListCalc(call, new Calc[] {listCalc, indexCalc})
{
public List evaluateList(Evaluator evaluator) {
List<Member[]> list = listCalc.evaluateList(evaluator);
if (list.size() == 0) {
return list;