Class InlineContext

java.lang.Object
org.basex.query.InlineContext

public final class InlineContext extends Object
Context for inlining expressions.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Compilation context.
    final Expr
    Expression to inline.
    final Var
    Variable reference, or null for context reference.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a copy from the expression to be inlined.
    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.
    Inlines an expression into the specified target expression, or returns null if no inlining is required.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • cc

      public final CompileContext cc
      Compilation context.
    • var

      public final Var var
      Variable reference, or null for context reference.
    • expr

      public final Expr expr
      Expression to inline.
  • Constructor Details

    • InlineContext

      public InlineContext(Var var, Expr expr, CompileContext cc)
      Constructor.
      Parameters:
      var - variable (Var reference) or context (null) to replace
      expr - expression to inline
      cc - compilation context
  • Method Details

    • inlineable

      public boolean inlineable(Expr... targets)
      Checks if inlining into the specified expressions is possible. See Expr.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. See Expr.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 returns null if no inlining is required. See Expr.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 update
      error - 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