org.basex.query.value.seq
Class RangeSeq

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.RangeSeq
All Implemented Interfaces:
java.lang.Iterable<Item>

public final class RangeSeq
extends Seq

Range sequence, containing at least two integers.

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
 boolean asc
          Ascending/descending.
 long start
          Start value.
 
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.
static Value get(long min, long sz, boolean asc)
          Returns a value representation of the specified items.
 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.
 void plan(FElem plan)
          Creates an expression tree.
 Value reverse()
          Returns a sequence in reverse order.
 boolean sameAs(Expr cmp)
          Compares the current and specified expression for equality.
 Value sub(long s, long sz)
          Returns a subsequence.
 java.lang.Object toJava()
          Returns a Java representation of the value.
 java.lang.String toString()
           
 SeqType type()
          Returns the static type of the evaluated value.
 int writeTo(Item[] arr, int pos)
          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, size, test
 
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, iterable, 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
 

Field Detail

start

public final long start
Start value.


asc

public final boolean asc
Ascending/descending.

Method Detail

get

public static Value get(long min,
                        long sz,
                        boolean asc)
Returns a value representation of the specified items.

Parameters:
min - minimum value
sz - size
asc - ascending
Returns:
resulting item or sequence

toJava

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

Overrides:
toJava in class Seq
Returns:
Java object

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

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 pos)
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
pos - 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

sub

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

Specified by:
sub in class Seq
Parameters:
s - first value
sz - 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

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

plan

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

Overrides:
plan in class Seq
Parameters:
plan - root element

toString

public java.lang.String toString()
Overrides:
toString in class Seq