org.basex.query.xquery.item
Class Item

java.lang.Object
  extended by org.basex.query.xquery.expr.Expr
      extended by org.basex.query.xquery.item.Item
Direct Known Subclasses:
B64, Bln, Date, Hex, Node, Num, QNm, Seq, Str

public abstract class Item
extends Expr

Abstract item.

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

Field Summary
 
Fields inherited from class org.basex.query.xquery.expr.Expr
type
 
Method Summary
 boolean bool()
          Returns a boolean representation of the item.
 Item castErr(java.lang.Object val)
          Throws a cast error.
 Expr comp(XQContext ctx)
          Optimizes and compiles the expression tree.
 double dbl()
          Returns a double representation of the item.
 int diff(Item it)
          Returns the difference between the current and the specified item.
abstract  boolean eq(Item it)
          Checks the items for equality.
 Item eval(XQContext ctx)
          Evaluates the expression and returns the resulting item.
 float flt()
          Returns a float representation of the item.
 boolean i()
          Checks if this is an item.
 java.lang.String info()
          Returns a string description of the expression.
 Iter iter()
          Returns an iterator.
 long itr()
          Returns a numeric (long) representation of the item.
 void serialize(PrintOutput out, XQContext ctx, int level)
          Serializes the item.
 void serialize(ResultReader rr, XQContext ctx, int level)
          Serializes the item.
 int size()
          Returns the sequence size or 0.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.query.xquery.expr.Expr
cls, d, e, n, node, s, str, u
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

bool

public boolean bool()
             throws XQException
Returns a boolean representation of the item.

Returns:
boolean value
Throws:
XQException - evaluation exception

castErr

public final Item castErr(java.lang.Object val)
                   throws XQException
Throws a cast error.

Parameters:
val - cast value
Returns:
dummy item
Throws:
XQException - evaluation exception

comp

public Expr comp(XQContext ctx)
Description copied from class: Expr
Optimizes and compiles the expression tree.

Specified by:
comp in class Expr
Parameters:
ctx - query context
Returns:
optimized Expression

dbl

public double dbl()
           throws XQException
Returns a double representation of the item.

Returns:
double value
Throws:
XQException - evaluation exception

diff

public int diff(Item it)
         throws XQException
Returns the difference between the current and the specified item.

Parameters:
it - item to be compared.
Returns:
difference
Throws:
XQException - evaluation exception

eq

public abstract boolean eq(Item it)
                    throws XQException
Checks the items for equality.

Parameters:
it - item to be compared.
Returns:
result of check
Throws:
XQException - evaluation exception

eval

public final Item eval(XQContext ctx)
Description copied from class: Expr
Evaluates the expression and returns the resulting item.

Specified by:
eval in class Expr
Parameters:
ctx - query context
Returns:
resulting item

flt

public float flt()
          throws XQException
Returns a float representation of the item.

Returns:
float value
Throws:
XQException - evaluation exception

i

public final boolean i()
Description copied from class: Expr
Checks if this is an item.

Overrides:
i in class Expr
Returns:
result of check

info

public final java.lang.String info()
Description copied from class: Expr
Returns a string description of the expression. Contrary to the Expr.toString() method, the current expressions aren't included in the output.

Specified by:
info in class Expr
Returns:
result of check

iter

public Iter iter()
Returns an iterator.

Returns:
result of check

itr

public long itr()
         throws XQException
Returns a numeric (long) representation of the item.

Returns:
long value
Throws:
XQException - evaluation exception

serialize

public void serialize(PrintOutput out,
                      XQContext ctx,
                      int level)
               throws XQException,
                      java.io.IOException
Serializes the item.

Parameters:
out - output stream
ctx - query context
level - current level
Throws:
java.io.IOException - I/O exception
XQException - evaluation exception

serialize

public void serialize(ResultReader rr,
                      XQContext ctx,
                      int level)
               throws org.xml.sax.SAXException
Serializes the item.

Parameters:
rr - content handler
ctx - query context
level - current level
Throws:
org.xml.sax.SAXException - SAX exception

size

public int size()
Description copied from class: Expr
Returns the sequence size or 0.

Overrides:
size in class Expr
Returns:
result of check

toString

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