Qizx/open API

net.axyana.qizxopen.xquery
Interface XQValue

All Superinterfaces:
java.io.Serializable, XQItem
All Known Implementing Classes:
net.axyana.qizxopen.xquery.dt.BaseValue

public interface XQValue
extends XQItem

Internal representation of the result of the evaluation of a query, which is a sequence of Items (XQItem). This interface generally cannot be used for remote access.

The next() method must be repeatedly invoked to check whether an item is available.

When next() returns true, the current item value can be retrieved by specialized methods getX() (defined in super-interface XQItem) according to its type.

Value has often the dual aspect of a sequence and an Item. It is not immutable, because of the next() method. It cannot be rewinded, but it can be regenerated by bornAgain().


Field Summary
 
Fields inherited from interface net.axyana.qizxopen.xquery.XQItem
INCOMPARABLE
 
Method Summary
 XQItem asAtom()
          Gets the current item with atomization.
 XQValue bornAgain()
          Returns a new version of the sequence in its initial state.
 XQItem getItem()
          Gets the current item (undefined result if end of sequence reached).
 boolean hasQuickIndex()
          Check whether quick indexing is supported.
 boolean next()
          Attempts to get the next atomic item.
 boolean nextCollection()
          Attempts to get the next atomic item, without expanding collections.
 long quickCount(EvalContext context)
          Optimized evaluation of count() or last().
 XQItem quickIndex(long index)
          Optimized evaluation of operator [] with integer $index.
 void setLazy(boolean lazy)
          Boosts iterations that dont need the item value (count(), skipping)
 boolean worthExpanding()
          Returns false if it is more efficient to keep the value as an iterator, and not to expand it into an array sequence.
 
Methods inherited from interface net.axyana.qizxopen.xquery.XQItem
compareTo, deepEqual, getBoolean, getDecimal, getDouble, getFloat, getInteger, getNode, getString, getType, isNode
 

Method Detail

next

public boolean next()
             throws XQueryException
Attempts to get the next atomic item. If true is returned, the item value is available through one of the specialized accessors.

Throws:
XQueryException

nextCollection

public boolean nextCollection()
                       throws XQueryException
Attempts to get the next atomic item, without expanding collections.

Throws:
XQueryException

getItem

public XQItem getItem()
               throws XQEvalException
Gets the current item (undefined result if end of sequence reached).

Throws:
XQEvalException

asAtom

public XQItem asAtom()
              throws XQEvalException
Gets the current item with atomization. If the current item is a Node, it is transparently transformed into a sequence of atomic values (in the future schema-aware implementation), or simply to its string value (in XQuery Basic).

Throws:
XQEvalException

bornAgain

public XQValue bornAgain()
Returns a new version of the sequence in its initial state. Value objects are in principle immutable, but due to the iterative implementation style (see the next() method), this is not actually true. Therefore when a value is used several times (in particular the value of a variable), there is a need for "regeneration".

NOTE: this needs not be a deep copy, because only the state of the iterator is concerned, not the underlying data.


worthExpanding

public boolean worthExpanding()
Returns false if it is more efficient to keep the value as an iterator, and not to expand it into an array sequence. This method is used when a value is stored into variable. It should return false only when the value is cheap to compute AND doesnt involve Node constructors (because of a problem with Node identity).


setLazy

public void setLazy(boolean lazy)
Boosts iterations that dont need the item value (count(), skipping)


quickCount

public long quickCount(EvalContext context)
                throws XQueryException
Optimized evaluation of count() or last(). Assumes the iterator to be in initial state.

Parameters:
context - evaluation context: used for monitoring.
Throws:
XQueryException

quickIndex

public XQItem quickIndex(long index)
                  throws XQueryException
Optimized evaluation of operator [] with integer $index.

Throws:
XQueryException

hasQuickIndex

public boolean hasQuickIndex()
Check whether quick indexing is supported.


© 2005 Axyana Software