Exemplo n.º 1
0
 /**
  * Checks if the specified item is a double. Returns the double or throws an exception.
  *
  * @param it item
  * @return double
  * @throws QueryException query exception
  */
 protected final double toDouble(final Item it) throws QueryException {
   if (checkNoEmpty(it, AtomType.DBL).type.isNumberOrUntyped()) return it.dbl(info);
   throw numberError(this, it);
 }
Exemplo n.º 2
0
 /**
  * Checks if the specified, non-empty item is a double. Returns the double or throws an exception.
  *
  * @param it item to be checked
  * @return number
  * @throws QueryException query exception
  */
 private ANum toNumber(final Item it) throws QueryException {
   if (it.type.isUntyped()) return Dbl.get(it.dbl(info));
   if (it instanceof ANum) return (ANum) it;
   throw numberError(this, it);
 }
Exemplo n.º 3
0
 @Override
 public final Item test(final QueryContext qc, final InputInfo ii) throws QueryException {
   final Item it = ebv(qc, info);
   return (it instanceof ANum ? it.dbl(info) == qc.pos : it.bool(info)) ? it : null;
 }