Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.expr
Class IndexedValue<T extends Item>

    java.lang.Object
      net.sf.saxon.value.Value<T>
          com.saxonica.expr.IndexedValue<T>

All Implemented Interfaces:
  ValueRepresentation<T>

    public class IndexedValue<T extends Item>

extends Value<T>

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.

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<T> iter)` Construct an indexed value (that is, a value that is capable of being indexed).

Method Summary
`SequenceIterator<T>` | `findItems(Expression 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
`T` | `itemAt(int n)` Get the n'th item in the sequence (starting from 0).
`SequenceIterator<T>` | `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, getSequenceLength, getStringValue, getStringValueCS, hashCode, isIdentical, process, reduce`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### IndexedValue

    public IndexedValue(SequenceIterator<T> 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<T> 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<T extends Item>`
  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 T 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<T extends Item>`
  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` - if an error occurs (for example if the value is a Closure that needs to be evaluated to find the Nth item)

### getLength

    public int getLength()
                  throws XPathException

  Get the length of the sequence

  Overrides:
    `getLength` in class `Value<T extends Item>`
  Returns:
    the number of items in the sequence
  Throws:
    `XPathException` - if an error occurs (for example if the value is a closure that needs to be read to determine its length)

### findItems

    public SequenceIterator<T> findItems(Expression 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`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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