com.saxonica.expr
Class IndexedValue

java.lang.Object
  extended by net.sf.saxon.value.Value
      extended by com.saxonica.expr.IndexedValue
All Implemented Interfaces:
Serializable, SequenceIterable, ValueRepresentation

public class IndexedValue
extends Value

A representation of a (sequence) value that allows the construction of one or more indexes to provide rapid access to the items in the sequence.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.value.Value
INDETERMINATE_ORDERING
 
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
 
Constructor Summary
IndexedValue(SequenceIterator iter)
          Construct an indexed value (that is, a value that is capable of being indexed).
 
Method Summary
 SequenceIterator findItems(SequenceIterable use, SequenceIterator values, boolean convertUntypedToOther, boolean firstOnly, AtomicComparer comparer, XPathContext context)
          Retrieve items that match a given index value
 int getLength()
          Get the length of the sequence
 Item itemAt(int n)
          Get the n'th item in the sequence (starting from 0).
 SequenceIterator iterate()
          Return an Iterator to iterate over the values of a sequence.
 
Methods inherited from class net.sf.saxon.value.Value
asItem, asItem, asIterator, asValue, checkPermittedContents, convertToJava, effectiveBooleanValue, equals, fromItem, getCanonicalLexicalRepresentation, getCardinality, getItemType, getIterator, getSchemaComparable, getStringValue, getStringValueCS, hashCode, isIdentical, iterate, process, reduce
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedValue

public IndexedValue(SequenceIterator iter)
             throws XPathException
Construct an indexed value (that is, a value that is capable of being indexed). Initially there will be no indexes, these are added later.

Parameters:
iter - iterator over the items to be included in the indexed value
Throws:
XPathException - if an error occurs reading the iterator
Method Detail

iterate

public SequenceIterator iterate()
                         throws XPathException
Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.

Specified by:
iterate in class Value
Returns:
a SequenceIterator that can be used to iterate over the result of the expression
Throws:
XPathException - if any dynamic error occurs evaluating the expression

itemAt

public Item itemAt(int n)
            throws XPathException
Get the n'th item in the sequence (starting from 0). This is defined for all Values, but its real benefits come for a sequence Value stored extensionally (or for a MemoClosure, once all the values have been read)

Overrides:
itemAt in class Value
Parameters:
n - position of the required item, counting from zero.
Returns:
the n'th item in the sequence, where the first item in the sequence is numbered zero. If n is negative or >= the length of the sequence, returns null.
Throws:
XPathException

getLength

public int getLength()
              throws XPathException
Get the length of the sequence

Overrides:
getLength in class Value
Returns:
the number of items in the sequence
Throws:
XPathException

findItems

public SequenceIterator findItems(SequenceIterable use,
                                  SequenceIterator values,
                                  boolean convertUntypedToOther,
                                  boolean firstOnly,
                                  AtomicComparer comparer,
                                  XPathContext context)
                           throws XPathException
Retrieve items that match a given index value

Parameters:
use - the expression whose value is to be matched
values - the set of values to be found
convertUntypedToOther - true if untypedAtomic values are to be converted to the type of the other operand
firstOnly - true if only the first matching item is required
comparer - AtomicComparer used to compare values for equality (encapsulates a collation if necessary)
context - the dynamic evaluation context @return an iterator over the items that match the specified values
Throws:
XPathException


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.