MCPcopy Create free account
hub / github.com/BaseXdb/basex / Expr

Class Expr

basex-core/src/main/java/org/basex/query/expr/Expr.java:32–563  ·  view source on GitHub ↗

Abstract class for representing XQuery expressions. Expression are divided into ParseExpr and Value classes. @author BaseX Team, BSD License @author Christian Gruen

Source from the content-addressed store, hash-verified

30 * @author Christian Gruen
31 */
32public abstract class Expr extends ExprInfo {
33 /**
34 * Checks if the updating semantics are satisfied.
35 * This function is only called if any updating expression was found in the query.
36 * @throws QueryException query exception
37 */
38 public abstract void checkUp() throws QueryException;
39
40 /**
41 * Compiles and optimizes the expression, assigns types and cardinalities.
42 * @param cc compilation context
43 * @return optimized expression
44 * @throws QueryException query exception
45 */
46 public abstract Expr compile(CompileContext cc) throws QueryException;
47
48 /**
49 * Optimizes an already compiled expression without recompiling its sub-expressions.
50 * @param cc compilation context
51 * @return optimized expression
52 * @throws QueryException query exception
53 */
54 @SuppressWarnings("unused")
55 public Expr optimize(final CompileContext cc) throws QueryException {
56 return this;
57 }
58
59 /**
60 * Evaluates the expression and returns an iterator on the resulting items.
61 * If this method is not implemented, either {@link #value(QueryContext)} or
62 * {@link #item(QueryContext, InputInfo)} must be implemented instead.
63 * @param qc query context
64 * @return iterator
65 * @throws QueryException query exception
66 */
67 public abstract Iter iter(QueryContext qc) throws QueryException;
68
69 /**
70 * Evaluates the expression and returns the resulting value.
71 * If this method is not implemented, either {@link #iter(QueryContext)} or
72 * {@link #item(QueryContext, InputInfo)} must be implemented instead.
73 * @param qc query context
74 * @return value
75 * @throws QueryException query exception
76 */
77 public abstract Value value(QueryContext qc) throws QueryException;
78
79 /**
80 * Evaluates the expression and returns the resulting item,
81 * or {@link Empty#VALUE} if the expression yields an empty sequence.
82 * If this method is not implemented, either {@link #iter(QueryContext)} or
83 * {@link #value(QueryContext)} must be implemented instead.
84 * @param qc query context
85 * @param ii input info (can be {@code null}; required for those {@link Value} instances
86 * that have no input info)
87 * @return item or {@link Empty#VALUE}
88 * @throws QueryException query exception
89 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected