Package org.basex.query
Class InlineContext
- java.lang.Object
-
- org.basex.query.InlineContext
-
public final class InlineContext extends Object
Context for inlining expressions.- Author:
- BaseX Team 2005-22, BSD License, Christian Gruen
-
-
Constructor Summary
Constructors Constructor Description InlineContext(Var var, Expr expr, CompileContext cc)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expr
copy()
Creates a copy from the expression to be inlined.Expr
inline(Expr target)
Inlines an expression into the specified target expression.boolean
inline(Expr[] exprs)
Inlines an expression into the specified expressions.boolean
inline(Expr[] exprs, boolean error)
Inlines an expression into the specified expressions.boolean
inlineable(Expr... targets)
Checks if inlining into the specified expressions is possible.Expr
inlineOrNull(Expr target)
Inlines an expression into the specified target expression, or returnsnull
if no inlining is required.
-
-
-
Field Detail
-
cc
public final CompileContext cc
Compilation context.
-
var
public final Var var
Variable reference, ornull
for context reference.
-
expr
public final Expr expr
Expression to inline.
-
-
Constructor Detail
-
InlineContext
public InlineContext(Var var, Expr expr, CompileContext cc)
Constructor.- Parameters:
var
- variable (Var
reference) or context (null
) to replaceexpr
- expression to inlinecc
- compilation context
-
-
Method Detail
-
inlineable
public boolean inlineable(Expr... targets)
Checks if inlining into the specified expressions is possible. SeeExpr.inlineable(org.basex.query.InlineContext)
for further details.- Parameters:
targets
- target expressions- Returns:
- result of check
-
inline
public Expr inline(Expr target) throws QueryException
Inlines an expression into the specified target expression. SeeExpr.inline(org.basex.query.InlineContext)
for further details.- Parameters:
target
- expression in which the expression will be inlined- Returns:
- optimized or original expression
- Throws:
QueryException
- query exception
-
inlineOrNull
public Expr inlineOrNull(Expr target) throws QueryException
Inlines an expression into the specified target expression, or returnsnull
if no inlining is required. SeeExpr.inline(org.basex.query.InlineContext)
for further details.- Parameters:
target
- expression in which the expression will be inlined- Returns:
- optimized expression or
null
- Throws:
QueryException
- query exception
-
inline
public boolean inline(Expr[] exprs) throws QueryException
Inlines an expression into the specified expressions.- Parameters:
exprs
- expressions to update- Returns:
true
if the array has changed,false
otherwise- Throws:
QueryException
- query exception
-
inline
public boolean inline(Expr[] exprs, boolean error) throws QueryException
Inlines an expression into the specified expressions.- Parameters:
exprs
- expressions to updateerror
- catch errors- Returns:
true
if the array has changed,false
otherwise- Throws:
QueryException
- query exception
-
copy
public Expr copy() throws QueryException
Creates a copy from the expression to be inlined.- Returns:
- copy
- Throws:
QueryException
- query exception
-
-