コード例 #1
0
ファイル: FnFunctionLookup.java プロジェクト: runeengh/basex
  @Override
  public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
    final QNm name = toQNm(exprs[0], qc, sc, false);
    final long arity = toLong(exprs[1], qc);
    if (arity < 0 || arity > Integer.MAX_VALUE) throw FUNCUNKNOWN_X.get(ii, name);

    try {
      final Expr lit = Functions.getLiteral(name, (int) arity, qc, sc, ii);
      return lit == null ? null : lit.item(qc, ii);
    } catch (final QueryException e) {
      // function not found (in most cases: XPST0017)
      return null;
    }
  }
コード例 #2
0
ファイル: ParseExpr.java プロジェクト: OliverEgli/basex-rss
 /**
  * Checks if the specified expression yields a string or empty sequence. Returns a token
  * representation or an exception.
  *
  * @param e expression to be evaluated
  * @param ctx query context
  * @return item
  * @throws QueryException query exception
  */
 public final byte[] checkEStr(final Expr e, final QueryContext ctx) throws QueryException {
   return checkEStr(e.item(ctx, input));
 }
コード例 #3
0
ファイル: ParseExpr.java プロジェクト: OliverEgli/basex-rss
 /**
  * Checks if the specified expression yields a non-empty item.
  *
  * @param e expression to be evaluated
  * @param ctx query context
  * @return item
  * @throws QueryException query exception
  */
 public final Item checkItem(final Expr e, final QueryContext ctx) throws QueryException {
   return checkEmpty(e.item(ctx, input));
 }
コード例 #4
0
ファイル: ParseExpr.java プロジェクト: OliverEgli/basex-rss
 /**
  * Checks if the specified expression is an integer. Returns a token representation or an
  * exception.
  *
  * @param e expression to be checked
  * @param ctx query context
  * @return integer value
  * @throws QueryException query exception
  */
 public final long checkItr(final Expr e, final QueryContext ctx) throws QueryException {
   return checkItr(checkNoEmpty(e.item(ctx, input), AtomType.ITR));
 }
コード例 #5
0
ファイル: ParseExpr.java プロジェクト: OliverEgli/basex-rss
  /**
   * Checks if the specified expression yields a double. Returns the double or throws an exception.
   *
   * @param e expression to be checked
   * @param ctx query context
   * @return double
   * @throws QueryException query exception
   */
  public final double checkDbl(final Expr e, final QueryContext ctx) throws QueryException {

    final Item it = checkNoEmpty(e.item(ctx, input), AtomType.DBL);
    if (!it.unt() && !it.num()) Err.number(this, it);
    return it.dbl(input);
  }
コード例 #6
0
ファイル: ParseExpr.java プロジェクト: OliverEgli/basex-rss
  /**
   * Checks if the specified expression yields a boolean. Returns the boolean or throws an
   * exception.
   *
   * @param e expression to be checked
   * @param ctx query context
   * @return boolean
   * @throws QueryException query exception
   */
  public final boolean checkBln(final Expr e, final QueryContext ctx) throws QueryException {

    final Item it = checkNoEmpty(e.item(ctx, input), AtomType.BLN);
    if (!it.unt() && it.type != AtomType.BLN) Err.type(this, AtomType.BLN, it);
    return it.bool(input);
  }