org.basex.query.value.seq
Class ItemSeq

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
                  extended by org.basex.query.value.seq.ItemSeq
All Implemented Interfaces:
java.lang.Iterable<Item>

public final class ItemSeq
extends Seq

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
 Item ebv(QueryContext ctx, InputInfo ii)
          Checks if the iterator can be dissolved into an effective boolean value.
 boolean homogeneous()
          Checks if all items of this value share the same type.
 Item itemAt(long pos)
          Gets the item at the given position in the value.
 boolean iterable()
          Returns true if the expression is iterable, i.e., if it will not contain any duplicate nodes and if all nodes will be are sorted.
 Value reverse()
          Returns a sequence in reverse order.
 boolean sameAs(Expr cmp)
          Compares the current and specified expression for equality.
 Value sub(long start, long length)
          Returns a subsequence.
 SeqType type()
          Returns the static type of the evaluated value.
 int writeTo(Item[] arr, int start)
          Writes this value's items out to the given array.
 
Methods inherited from class org.basex.query.value.seq.Seq
get, get, hash, item, iter, plan, size, test, toJava, toString
 
Methods inherited from class org.basex.query.value.Value
accept, cache, checkUp, compile, copy, count, data, description, exprSize, has, inline, isValue, iter, iterator, removable, serialize, value
 
Methods inherited from class org.basex.query.expr.Expr
addText, compEbv, copy, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isItem, isVacuous, markTailCalls, optimize, 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

ebv

public Item ebv(QueryContext ctx,
                InputInfo ii)
         throws QueryException
Description copied from class: Expr
Checks if the iterator can be dissolved into an effective boolean value. If not, returns an error. If yes, returns the first value - which can be also be e.g. an integer, which is later evaluated as numeric predicate.

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

type

public SeqType type()
Description copied from class: Expr
Returns the static type of the evaluated value. For simplicity, some types have been merged to super types. As an example, many numeric types are treated as integers.

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

iterable

public boolean iterable()
Description copied from class: Expr
Returns true if the expression is iterable, i.e., if it will not contain any duplicate nodes and if all nodes will be are sorted. The return value of this method is only relevant for node sequences. It is e.g. called by AxisPath.

Overrides:
iterable in class Expr
Returns:
result of check

sameAs

public boolean sameAs(Expr cmp)
Description copied from class: Expr
Compares the current and specified expression for equality.

Overrides:
sameAs in class Expr
Parameters:
cmp - expression to be compared
Returns:
result of check

writeTo

public int writeTo(Item[] arr,
                   int start)
Description copied from class: Value
Writes this value's items out to the given array.

Specified by:
writeTo in class Value
Parameters:
arr - array to write to
start - start position
Returns:
number of written items

itemAt

public Item itemAt(long pos)
Description copied from class: Value
Gets the item at the given position in the value.

Specified by:
itemAt in class Value
Parameters:
pos - position
Returns:
item

homogeneous

public boolean homogeneous()
Description copied from class: Value
Checks if all items of this value share the same type.

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

sub

public Value sub(long start,
                 long length)
Description copied from class: Seq
Returns a subsequence.

Specified by:
sub in class Seq
Parameters:
start - first value
length - length of sequence
Returns:
resulting item or sequence

reverse

public Value reverse()
Description copied from class: Seq
Returns a sequence in reverse order.

Specified by:
reverse in class Seq
Returns:
sequence