org.basex.query.xpath.values
Class Item

java.lang.Object
  extended by org.basex.query.xpath.expr.Expr
      extended by org.basex.query.xpath.values.Item
All Implemented Interfaces:
Result
Direct Known Subclasses:
Bool, Literal, NodeSet, Num

public abstract class Item
extends Expr
implements Result

Interface for all XPath items (results of expressions).

Author:
Workgroup DBIS, University of Konstanz 2005-07, ISC License, Tim Petrowsky

Constructor Summary
Item()
           
 
Method Summary
abstract  boolean bool()
          Returns the boolean value.
 Expr compile(XPContext ctx)
          Tries to optimize 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 sameAs(Result v)
          Compares values for equality.
 void serialize(PrintOutput out, boolean valid)
          Serializes the stored data to the specified output stream.
 void serialize(ResultReader rr)
          Serializes the stored data to the specified reader.
 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 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

compile

public final Expr compile(XPContext ctx)
Description copied from class: Expr
Tries to optimize the Expression.

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

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.

num

public abstract double num()
Returns the double value.

Returns:
double value

sameAs

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

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

serialize

public final void serialize(PrintOutput out,
                            boolean valid)
                     throws java.io.IOException
Serializes the stored data to the specified output stream.

Specified by:
serialize in interface Result
Parameters:
out - output stream
valid - well-formed output
Throws:
java.io.IOException - in case of problems with the PrintOutput

serialize

public final void serialize(ResultReader rr)
Serializes the stored data to the specified reader.

Specified by:
serialize in interface Result
Parameters:
rr - default handler

size

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

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

str

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

Returns:
literal value

toString

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

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

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