org.exist.xquery.value
Class ValueSequence

java.lang.Object
  extended byorg.exist.xquery.value.AbstractSequence
      extended byorg.exist.xquery.value.ValueSequence
All Implemented Interfaces:
Sequence

public class ValueSequence
extends AbstractSequence

A sequence that may contain a mixture of atomic values and nodes.

Author:
wolf

Field Summary
 
Fields inherited from interface org.exist.xquery.value.Sequence
EMPTY_SEQUENCE
 
Constructor Summary
ValueSequence()
           
ValueSequence(int initialSize)
           
ValueSequence(Sequence otherSequence)
           
 
Method Summary
 void add(Item item)
          Add an item to the current sequence.
 void addAll(Sequence otherSequence)
          Add all items of the other sequence to this item.
 void clear()
           
 void clearContext(int contextId)
          For every item in the sequence, clear any context-dependant information that is stored during query processing.
 DocumentSet getDocumentSet()
          Returns the set of documents from which the node items in this sequence have been selected.
 int getItemType()
          Return the primary type to which all items in this sequence belong.
 int getLength()
          Returns the number of items contained in the sequence.
 boolean hasOne()
          Returns whether the sequence has just one item or not.
 boolean isEmpty()
          Returns whether the sequence is empty or not.
 boolean isPersistentSet()
           
 Item itemAt(int pos)
          Returns the item located at the specified position within this sequence.
 SequenceIterator iterate()
          Returns an iterator over all items in the sequence.
 void removeDuplicates()
          Explicitely remove all duplicate nodes from this sequence.
 void setHolderVariable(Variable var)
           
 void sortInDocumentOrder()
           
 NodeSet toNodeSet()
          Makes all in-memory nodes in this sequence persistent, so they can be handled like other node sets.
 java.lang.String toString()
           
 SequenceIterator unorderedIterator()
          Returns an iterator over all items in the sequence.
 
Methods inherited from class org.exist.xquery.value.AbstractSequence
conversionPreference, convertTo, effectiveBooleanValue, getCardinality, getStringValue, hasMany, isCached, setIsCached, setSelfAsContext, toJavaObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueSequence

public ValueSequence()

ValueSequence

public ValueSequence(int initialSize)

ValueSequence

public ValueSequence(Sequence otherSequence)
              throws XPathException
Method Detail

clear

public void clear()

isEmpty

public boolean isEmpty()
Description copied from interface: Sequence
Returns whether the sequence is empty or not.

Specified by:
isEmpty in interface Sequence
Specified by:
isEmpty in class AbstractSequence

hasOne

public boolean hasOne()
Description copied from interface: Sequence
Returns whether the sequence has just one item or not.

Specified by:
hasOne in interface Sequence
Specified by:
hasOne in class AbstractSequence

add

public void add(Item item)
Description copied from interface: Sequence
Add an item to the current sequence. An XPathException may be thrown if the item's type is incompatible with this type of sequence (e.g. if the sequence is a node set). The sequence may or may not allow duplicate values.

Specified by:
add in interface Sequence
Specified by:
add in class AbstractSequence

addAll

public void addAll(Sequence otherSequence)
            throws XPathException
Description copied from interface: Sequence
Add all items of the other sequence to this item. An XPathException may be thrown if the type of the items in the other sequence is incompatible with the primary type of this sequence.

Specified by:
addAll in interface Sequence
Overrides:
addAll in class AbstractSequence
Throws:
XPathException

getItemType

public int getItemType()
Description copied from interface: Sequence
Return the primary type to which all items in this sequence belong. This is Type.NODE for node sets, Type.ITEM for other sequences with mixed items.

Specified by:
getItemType in interface Sequence
Specified by:
getItemType in class AbstractSequence

iterate

public SequenceIterator iterate()
                         throws XPathException
Description copied from interface: Sequence
Returns an iterator over all items in the sequence. The items are returned in document order where applicable.

Specified by:
iterate in interface Sequence
Specified by:
iterate in class AbstractSequence
Throws:
XPathException

unorderedIterator

public SequenceIterator unorderedIterator()
Description copied from interface: Sequence
Returns an iterator over all items in the sequence. The returned items may - but need not - to be in document order.

Specified by:
unorderedIterator in interface Sequence
Specified by:
unorderedIterator in class AbstractSequence

getLength

public int getLength()
Description copied from interface: Sequence
Returns the number of items contained in the sequence. Call this method only when necessary, since it can be resource consuming.

Specified by:
getLength in interface Sequence
Specified by:
getLength in class AbstractSequence

itemAt

public Item itemAt(int pos)
Description copied from interface: Sequence
Returns the item located at the specified position within this sequence. Items are counted beginning at 0.

Specified by:
itemAt in interface Sequence
Specified by:
itemAt in class AbstractSequence

setHolderVariable

public void setHolderVariable(Variable var)

toNodeSet

public NodeSet toNodeSet()
                  throws XPathException
Makes all in-memory nodes in this sequence persistent, so they can be handled like other node sets.

Throws:
XPathException - if the sequence contains items which are not nodes.
See Also:
Sequence.toNodeSet()

isPersistentSet

public boolean isPersistentSet()
Specified by:
isPersistentSet in interface Sequence
Overrides:
isPersistentSet in class AbstractSequence

sortInDocumentOrder

public void sortInDocumentOrder()

removeDuplicates

public void removeDuplicates()
Description copied from interface: Sequence
Explicitely remove all duplicate nodes from this sequence.


clearContext

public void clearContext(int contextId)
Description copied from interface: Sequence
For every item in the sequence, clear any context-dependant information that is stored during query processing. This feature is used for node sets, which may store information about their context node.

Specified by:
clearContext in interface Sequence
Overrides:
clearContext in class AbstractSequence

getDocumentSet

public DocumentSet getDocumentSet()
Description copied from interface: Sequence
Returns the set of documents from which the node items in this sequence have been selected. This is for internal use only.

Specified by:
getDocumentSet in interface Sequence
Overrides:
getDocumentSet in class AbstractSequence

toString

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


Copyright (C) Wolfgang Meier. All rights reserved.