//---------------------------------------------------------------------------
public int parseToken(String token) throws BadResumptionTokenException
{
if (!Lib.isInteger(token))
throw new BadResumptionTokenException("Invalid token : "+ token);
if (ids == null) {
throw new IllegalStateException("res.ids should not be null");
}
int pos = Integer.parseInt(token);
if (pos >= ids.size())
throw new BadResumptionTokenException("Token beyond limit : "+ token);
this.token = token;
return pos;
}