org.basex.query.value.seq
Class Seq

java.lang.Object
  extended by org.basex.data.ExprInfo
      extended by org.basex.query.expr.Expr
          extended by org.basex.query.value.Value
              extended by org.basex.query.value.seq.Seq
All Implemented Interfaces:
java.lang.Iterable<Item>
Direct Known Subclasses:
ItemSeq, NativeSeq, RangeSeq

public abstract class Seq
extends Value

Sequence, containing at least two items.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.basex.query.expr.Expr
Expr.Flag
 
Field Summary
 
Fields inherited from class org.basex.query.value.Value
type
 
Method Summary
static Value get(Item[] v, int s)
          Returns a value representation of the specified items.
static Value get(Item[] v, int s, Type t)
          Returns a value representation of the specified items.
 int hash(InputInfo ii)
          Returns a hash code for this value.
 Item item(QueryContext ctx, InputInfo ii)
          Evaluates the expression and returns the resulting item or a null reference, if the expression yields an empty sequence.
 ValueIter iter()
          Returns an iterator.
 void plan(FElem plan)
          Creates an expression tree.
abstract  Value reverse()
          Returns a sequence in reverse order.
 long size()
          Returns the sequence size or 1.
abstract  Value sub(long start, long length)
          Returns a subsequence.
 Item test(QueryContext ctx, InputInfo ii)
          Performs a predicate test and returns the item if test was successful.
 java.lang.Object toJava()
          Returns a Java representation of the value.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.query.value.Value
accept, cache, checkUp, compile, copy, count, data, description, exprSize, has, homogeneous, inline, isValue, itemAt, iter, iterator, removable, serialize, value, writeTo
 
Methods inherited from class org.basex.query.expr.Expr
addText, compEbv, copy, ebv, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isItem, isVacuous, iterable, markTailCalls, optimize, sameAs, type, uses, visitAll
 
Methods inherited from class org.basex.data.ExprInfo
addPlan, addPlan, info, planAttr, planElem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

get

public static Value get(Item[] v,
                        int s)
Returns a value representation of the specified items.

Parameters:
v - value
s - size
Returns:
resulting item or sequence

get

public static Value get(Item[] v,
                        int s,
                        Type t)
Returns a value representation of the specified items.

Parameters:
v - value
s - size
t - sequence type
Returns:
resulting item or sequence

toJava

public java.lang.Object toJava()
                        throws QueryException
Description copied from class: Value
Returns a Java representation of the value.

Specified by:
toJava in class Value
Returns:
Java object
Throws:
QueryException - query exception

size

public final long size()
Description copied from class: Expr
Returns the sequence size or 1.

Specified by:
size in class Value
Returns:
result of check

item

public final Item item(QueryContext ctx,
                       InputInfo ii)
                throws QueryException
Description copied from class: Expr
Evaluates the expression and returns the resulting item or a null reference, if the expression yields an empty sequence. If this method is not overwritten, Expr.iter(org.basex.query.QueryContext) must be implemented by an expression, as it may be called by this method.

Specified by:
item in class Expr
Parameters:
ctx - query context
ii - input info
Returns:
iterator
Throws:
QueryException - query exception

test

public final Item test(QueryContext ctx,
                       InputInfo ii)
                throws QueryException
Description copied from class: Expr
Performs a predicate test and returns the item if test was successful.

Specified by:
test in class Expr
Parameters:
ctx - query context
ii - input info
Returns:
item
Throws:
QueryException - query exception

iter

public final ValueIter iter()
Description copied from class: Value
Returns an iterator.

Specified by:
iter in class Value
Returns:
iterator

hash

public final int hash(InputInfo ii)
               throws QueryException
Description copied from class: Value
Returns a hash code for this value.

Specified by:
hash in class Value
Parameters:
ii - input info
Returns:
hash code
Throws:
QueryException - if atomization can't be applied (e.g. function item)

sub

public abstract Value sub(long start,
                          long length)
Returns a subsequence.

Parameters:
start - first value
length - length of sequence
Returns:
resulting item or sequence

reverse

public abstract Value reverse()
Returns a sequence in reverse order.

Returns:
sequence

plan

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

Specified by:
plan in class ExprInfo
Parameters:
plan - root element

toString

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