for (Object arg : range.arguments()) {
final Object elt = ((ExpressionNodeForConstantValue) arg).value();
if (_lookup.equals( elt )) return iObj;
iObj++;
}
throw new NotAvailableException();
}
else {
final Comparable comp = (Comparable) _lookup;
final int isToRightWhenComparesAs = (_type > 0) ? 1 : -1;
final List<ExpressionNode> args = range.arguments();
final int iLast = args.size() - 1;
int iLeft = 0;
int iRight = iLast;
while (iLeft < iRight) {
final int iMid = iLeft + ((iRight - iLeft) >> 1);
final Object arg = args.get( iMid );
final Object elt = ((ExpressionNodeForConstantValue) arg).value();
final int compRes = comp.compareTo( elt );
if (compRes == isToRightWhenComparesAs) iLeft = iMid + 1;
else iRight = iMid;
}
if (iLeft <= iLast) {
final Object arg = args.get( iLeft );
final Object elt = ((ExpressionNodeForConstantValue) arg).value();
final int compRes = comp.compareTo( elt );
if (compRes == 0 || compRes == isToRightWhenComparesAs) return iLeft;
}
if (iLeft == 0) throw new NotAvailableException();
return iLeft - 1;
}
}