i++;
}
String v = this.getVarName(ctx);
String vs = this.getVarStatusName(ctx);
VariableMapper vars = ctx.getVariableMapper();
ValueExpression ve = null;
ValueExpression vO = this.capture(v, vars);
ValueExpression vsO = this.capture(vs, vars);
int mi = 0;
Object value = null;
try
{
boolean first = true;
while (i <= e && itr.hasNext())
{
value = itr.next();
// set the var
if (v != null)
{
if (t || srcVE == null)
{
ctx.setAttribute(v, value);
}
else
{
ve = this.getVarExpr(srcVE, src, value, i);
vars.setVariable(v, ve);
}
}
// set the varStatus
if (vs != null)
{
IterationStatus itrS = new IterationStatus(first, !itr.hasNext(), i, sO, eO, mO, value);
if (t || srcVE == null)
{
ctx.setAttribute(vs, itrS);
}
else
{
ve = new IterationStatusExpression(itrS);
vars.setVariable(vs, ve);
}
}
// execute body
this.nextHandler.apply(ctx, parent);
// increment steps
mi = 1;
while (mi < m && itr.hasNext())
{
itr.next();
mi++;
i++;
}
i++;
first = false;
}
}
finally
{
if (v != null)
{
vars.setVariable(v, vO);
}
if (vs != null)
{
vars.setVariable(vs, vsO);
}
}
}
}