org.basex.query.xquery.util
Class Var

java.lang.Object
  extended by org.basex.query.ExprInfo
      extended by org.basex.query.xquery.util.Var
All Implemented Interfaces:
java.lang.Cloneable

public final class Var
extends ExprInfo
implements java.lang.Cloneable

Variable.

Author:
Workgroup DBIS, University of Konstanz 2005-08, ISC License, Christian Gruen

Field Summary
 Expr expr
          Variable expressions.
 boolean global
          Global flag.
 Item item
          Variable results.
 QNm name
          Variable name.
 SeqType type
          Data type.
 
Constructor Summary
Var(QNm n)
          Constructor.
Var(QNm n, SeqType t)
          Constructor.
 
Method Summary
 Item check(Item it, XQContext ctx)
          Checks the variable type.
 Var clone()
           
 void comp(XQContext ctx)
          Compiles the variable.
 Var expr(Expr e, XQContext ctx)
          Binds the specified expression to the variable.
 Var item(Item it, XQContext ctx)
          Binds the specified item to the variable.
 Item item(XQContext ctx)
          Evaluates the variable.
 Iter iter(XQContext ctx)
          Evaluates the variable.
 void plan(Serializer ser)
          Recursively sends the abstract syntax of this expression to the specified serializer.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.query.ExprInfo
color, info, name
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public QNm name
Variable name.


type

public SeqType type
Data type.


expr

public Expr expr
Variable expressions.


item

public Item item
Variable results.


global

public boolean global
Global flag.

Constructor Detail

Var

public Var(QNm n)
Constructor.

Parameters:
n - variable name

Var

public Var(QNm n,
           SeqType t)
Constructor.

Parameters:
n - variable name
t - data type
Method Detail

comp

public void comp(XQContext ctx)
          throws XQException
Compiles the variable.

Parameters:
ctx - xquery context
Throws:
XQException - xquery exception

expr

public Var expr(Expr e,
                XQContext ctx)
         throws XQException
Binds the specified expression to the variable.

Parameters:
e - expression to be set
ctx - query context
Returns:
self reference
Throws:
XQException - evaluation exception

item

public Var item(Item it,
                XQContext ctx)
         throws XQException
Binds the specified item to the variable.

Parameters:
it - item to be set
ctx - query context
Returns:
self reference
Throws:
XQException - evaluation exception

iter

public Iter iter(XQContext ctx)
          throws XQException
Evaluates the variable.

Parameters:
ctx - query context
Returns:
iterator
Throws:
XQException - query exception

item

public Item item(XQContext ctx)
          throws XQException
Evaluates the variable.

Parameters:
ctx - query context
Returns:
iterator
Throws:
XQException - query exception

check

public Item check(Item it,
                  XQContext ctx)
           throws XQException
Checks the variable type.

Parameters:
it - input item
ctx - query context
Returns:
cast item
Throws:
XQException - query exception

clone

public Var clone()
Overrides:
clone in class java.lang.Object

toString

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

plan

public void plan(Serializer ser)
          throws java.io.IOException
Description copied from class: ExprInfo
Recursively sends the abstract syntax of this expression to the specified serializer.

Specified by:
plan in class ExprInfo
Parameters:
ser - serializer
Throws:
java.io.IOException - exception