org.basex.query.var
Class StaticVar

java.lang.Object
  extended by org.basex.data.ExprInfo
      extended by org.basex.query.StaticScope
          extended by org.basex.query.StaticDecl
              extended by org.basex.query.var.StaticVar
All Implemented Interfaces:
Scope

public final class StaticVar
extends StaticDecl

Static variable to which an expression can be assigned.

Author:
BaseX Team 2005-12, BSD License, Leo Woerteler

Field Summary
 
Fields inherited from class org.basex.query.StaticDecl
ann, declType, dontEnter, name, sc
 
Fields inherited from class org.basex.query.StaticScope
compiled, expr, info, scope
 
Constructor Summary
StaticVar(QueryContext ctx, QNm nm, InputInfo ii)
          Constructor for implicitly declared external variables.
 
Method Summary
 boolean bind(Expr e, QueryContext ctx)
          Binds an expression to this variable from outside the query.
 void checkUp()
          Checks for the correct placement of updating expressions in this variable.
 void compile(QueryContext ctx)
          Compiles the expression contained in this scope.
 java.lang.StringBuilder fullDesc(java.lang.StringBuilder sb)
          Adds the description of this variable to the given string builder.
 byte[] id()
          Returns a unique identifier for this declaration.
 void plan(FElem plan)
          Creates an expression tree.
 java.lang.String toString()
           
 Value value(QueryContext ctx)
          Evaluates this variable lazily.
 boolean visit(ASTVisitor visitor)
          Traverses this scope with the given ASTVisitor.
 
Methods inherited from class org.basex.query.StaticDecl
type
 
Methods inherited from class org.basex.query.StaticScope
compiled, doc
 
Methods inherited from class org.basex.data.ExprInfo
addPlan, addPlan, description, info, planAttr, planElem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StaticVar

public StaticVar(QueryContext ctx,
                 QNm nm,
                 InputInfo ii)
Constructor for implicitly declared external variables.

Parameters:
ctx - query context
nm - variable name
ii - input info
Method Detail

compile

public void compile(QueryContext ctx)
             throws QueryException
Description copied from interface: Scope
Compiles the expression contained in this scope.

Parameters:
ctx - query context
Throws:
QueryException - compilation errors

value

public Value value(QueryContext ctx)
            throws QueryException
Evaluates this variable lazily.

Parameters:
ctx - query context
Returns:
value of this variable
Throws:
QueryException - query exception

checkUp

public void checkUp()
             throws QueryException
Checks for the correct placement of updating expressions in this variable.

Throws:
QueryException - query exception

bind

public boolean bind(Expr e,
                    QueryContext ctx)
             throws QueryException
Binds an expression to this variable from outside the query.

Parameters:
e - value to bind
ctx - query context
Returns:
if the value could be bound
Throws:
QueryException - query exception

plan

public void plan(FElem plan)
Description copied from class: ExprInfo
Creates an expression tree.

Specified by:
plan in class ExprInfo
Parameters:
plan - root element

visit

public boolean visit(ASTVisitor visitor)
Description copied from interface: Scope
Traverses this scope with the given ASTVisitor.

Parameters:
visitor - visitor
Returns:
continue flag

fullDesc

public java.lang.StringBuilder fullDesc(java.lang.StringBuilder sb)
Adds the description of this variable to the given string builder.

Parameters:
sb - string builder
Returns:
the string builder for convenience

toString

public java.lang.String toString()
Specified by:
toString in class ExprInfo

id

public byte[] id()
Description copied from class: StaticDecl
Returns a unique identifier for this declaration.

Specified by:
id in class StaticDecl
Returns:
a byte sequence that uniquely identifies this declaration