예제 #1
0
  /**
   * Checks the items for equivalence.
   *
   * @param ii input info
   * @param it item to be compared
   * @return result of check
   * @throws QueryException query exception
   */
  public final boolean equiv(final InputInfo ii, final Item it) throws QueryException {

    // check if both values are NaN, or if values are equal..
    return (this == Dbl.NAN || this == Flt.NAN) && it.num() && Double.isNaN(it.dbl(ii))
        || comparable(it) && eq(ii, it);
  }
예제 #2
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);
 }
예제 #3
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);
 }
예제 #4
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;
 }