org.basex.query.xpath.item
Class Item

java.lang.Object
  extended by org.basex.query.ExprInfo
      extended by org.basex.query.xpath.expr.Expr
          extended by org.basex.query.xpath.item.Item
All Implemented Interfaces:
Result
Direct Known Subclasses:
Bln, Dbl, Nod, Str

public abstract class Item
extends Expr
implements Result

Interface for all XPath items (results of expressions).

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

Constructor Summary
Item()
           
 
Method Summary
abstract  boolean bool()
          Returns the boolean value.
 Expr comp(XPContext ctx)
          Optimizes the expression.
abstract  boolean eq(Item v)
          Checks the equality of the value and the specified value.
abstract  double num()
          Returns the double value.
 boolean same(Result v)
          Compares values for equality.
 void serialize(Serializer ser)
          Serializes the complete result.
 void serialize(Serializer ser, int n)
          Serializes the specified result.
 int size()
          Number of values, stored in the result instance.
abstract  byte[] str()
          Returns the literal value.
abstract  java.lang.String toString()
           
 boolean usesPos()
          Checks whether this Expression (or its children) make use of the position parameter.
 boolean usesSize()
          Checks whether this Expression (or its children) make use of the setsize parameter.
 
Methods inherited from class org.basex.query.xpath.expr.Expr
eval, indexEquivalent, indexSizes, returnedValue, sameAs
 
Methods inherited from class org.basex.query.ExprInfo
color, info, name, plan
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Item

public Item()
Method Detail

bool

public abstract boolean bool()
Returns the boolean value.

Returns:
boolean value

str

public abstract byte[] str()
Returns the literal value.

Returns:
literal value

num

public abstract double num()
Returns the double value.

Returns:
double value

eq

public abstract boolean eq(Item v)
Checks the equality of the value and the specified value.

Parameters:
v - value to be compared
Returns:
result of comparison.

comp

public final Expr comp(XPContext ctx)
Description copied from class: Expr
Optimizes the expression.

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

usesSize

public final boolean usesSize()
Description copied from class: Expr
Checks whether this Expression (or its children) make use of the setsize parameter. If not this allows early predicate evaluation.

Specified by:
usesSize in class Expr
Returns:
whether setsize is used

usesPos

public final boolean usesPos()
Description copied from class: Expr
Checks whether this Expression (or its children) make use of the position parameter. If not this allows some nice optimizations.

Specified by:
usesPos in class Expr
Returns:
whether position is used

toString

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

size

public int size()
Number of values, stored in the result instance.

Specified by:
size in interface Result
Returns:
number of values

same

public final boolean same(Result v)
Compares values for equality.

Specified by:
same in interface Result
Parameters:
v - value to be compared
Returns:
true if values are equal

serialize

public void serialize(Serializer ser)
               throws java.io.IOException
Serializes the complete result.

Specified by:
serialize in interface Result
Parameters:
ser - serializer
Throws:
java.io.IOException - exception

serialize

public void serialize(Serializer ser,
                      int n)
               throws java.io.IOException
Serializes the specified result.

Specified by:
serialize in interface Result
Parameters:
ser - serializer
n - number of result to serialize
Throws:
java.io.IOException - exception