org.basex.query
Class MainModule

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

public class MainModule
extends StaticScope

An XQuery main module.

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

Field Summary
 SeqType declType
          Declared type, null if not specified.
 
Fields inherited from class org.basex.query.StaticScope
compiled, expr, info, scope
 
Constructor Summary
MainModule(Expr rt, VarScope scp, SeqType type, java.lang.String xqdoc, InputInfo ii)
          Constructor.
MainModule(Expr rt, VarScope scp, java.lang.String xqdoc)
          Constructor.
 
Method Summary
 void compile(QueryContext ctx)
          Compiles the expression contained in this scope.
 boolean databases(LockResult lr, QueryContext ctx)
          Adds the names of the databases that may be touched by the module.
 Iter iter(QueryContext ctx)
          Creates a result iterator which lazily evaluates this module.
 void plan(FElem e)
          Creates an expression tree.
 java.lang.String toString()
           
 Value value(QueryContext ctx)
          Evaluates this module and returns the result as a value.
 boolean visit(ASTVisitor visitor)
          Traverses this scope with the given ASTVisitor.
 
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
 

Field Detail

declType

public final SeqType declType
Declared type, null if not specified.

Constructor Detail

MainModule

public MainModule(Expr rt,
                  VarScope scp,
                  java.lang.String xqdoc)
Constructor.

Parameters:
rt - root expression
scp - variable scope
xqdoc - documentation

MainModule

public MainModule(Expr rt,
                  VarScope scp,
                  SeqType type,
                  java.lang.String xqdoc,
                  InputInfo ii)
Constructor.

Parameters:
rt - root expression
scp - variable scope
xqdoc - documentation
type - optional type
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 module and returns the result as a value.

Parameters:
ctx - query context
Returns:
result
Throws:
QueryException - evaluation exception

iter

public Iter iter(QueryContext ctx)
          throws QueryException
Creates a result iterator which lazily evaluates this module.

Parameters:
ctx - query context
Returns:
result iterator
Throws:
QueryException - query exception

toString

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

plan

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

Specified by:
plan in class ExprInfo
Parameters:
e - 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

databases

public boolean databases(LockResult lr,
                         QueryContext ctx)
Adds the names of the databases that may be touched by the module.

Parameters:
lr - lock result
ctx - query context
Returns:
result of check
See Also:
Proc.databases(LockResult)