/** * Checks if the specified expression yields an element. Returns the element or throws an * exception. * * @param ex expression to be evaluated * @param qc query context * @return binary item * @throws QueryException query exception */ protected final ANode toElem(final Expr ex, final QueryContext qc) throws QueryException { return (ANode) checkType(ex.item(qc, info), NodeType.ELM); }
/** * Checks if the specified expression yields a non-empty item. Returns the item or throws an * exception. * * @param ex expression to be evaluated * @param qc query context * @param type expected type * @return item * @throws QueryException query exception */ private Item toItem(final Expr ex, final QueryContext qc, final Type type) throws QueryException { return checkNoEmpty(ex.item(qc, info), type); }
/** * Checks if the specified expression yields a node or {@code null}. Returns the node, {@code * null}, or throws an exception. * * @param ex expression to be evaluated * @param qc query context * @return node or {@code null} * @throws QueryException query exception */ protected final ANode toEmptyNode(final Expr ex, final QueryContext qc) throws QueryException { final Item it = ex.item(qc, info); return it == null ? null : toNode(it); }
/** * Checks if the evaluated expression yields a non-empty item. Returns the item or throws an * exception. * * @param ex expression to be evaluated * @param qc query context * @return item * @throws QueryException query exception */ protected final Item toItem(final Expr ex, final QueryContext qc) throws QueryException { return checkNoEmpty(ex.item(qc, info)); }
/** * Checks if the specified expression yields a node. Returns the boolean or throws an exception. * * @param ex expression to be evaluated * @param qc query context * @return node * @throws QueryException query exception */ protected final ANode toNode(final Expr ex, final QueryContext qc) throws QueryException { return toNode(checkNoEmpty(ex.item(qc, info), NodeType.NOD)); }