Package com.saxonica.ee.optim

## Class IndexedValue

- java.lang.Object
- - com.saxonica.ee.optim.SearchableValue
  - - com.saxonica.ee.optim.IndexedValue

- All Implemented Interfaces:
    `GroundedValue`, `Sequence`

      public class IndexedValue
      extends SearchableValue

  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 com.saxonica.ee.optim.SearchableValue

      `end, value`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `containsNode​(NodeInfo sought)` | Determine whether the value contains a particular node.
    `SequenceIterator` | `findItems​(Expression use, SequenceIterator values, boolean convertUntypedToOther, boolean firstOnly, AtomicComparer comparer, XPathContext context)` | Retrieve items that match a given index value

    - ### Methods inherited from class com.saxonica.ee.optim.SearchableValue

      `effectiveBooleanValue, getLength, getStringValue, getStringValueCS, head, itemAt, iterate, makeSearchableValue, reduce, subsequence`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.sf.saxon.om.GroundedValue

      `asIterable, concatenate, materialize, toShortString`

    - ### Methods inherited from interface net.sf.saxon.om.Sequence

      `makeRepeatable`

- - ### Method Detail

    - #### findItems

          public SequenceIterator findItems​(Expression use,
                                            SequenceIterator values,
                                            boolean convertUntypedToOther,
                                            boolean firstOnly,
                                            AtomicComparer comparer,
                                            XPathContext context)
                                     throws XPathException

      Retrieve items that match a given index value
      Specified by:
        `findItems` in class `SearchableValue`
      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
      Returns:
        an iterator over the items that matched
      Throws:
        `XPathException` - if an error occurs

    - #### containsNode

          public boolean containsNode​(NodeInfo sought)

      Determine whether the value contains a particular node. This implementation of the method builds a representation of the node-sequence as a Java HashSet the first time it is invoked, and subsequently does a fast lookup in this HashSet rather than performing a sequential search.
      Parameters:
        `sought` - the sought-after node
      Returns:
        true if the value contains this node