com.saxonica.extra
Class IndexedClosure
java.lang.Object
net.sf.saxon.value.Value
net.sf.saxon.value.Closure
net.sf.saxon.value.MemoClosure
com.saxonica.extra.IndexedClosure
- All Implemented Interfaces:
- Expression, java.io.Serializable, ValueRepresentation
- public class IndexedClosure
- extends MemoClosure
A subclass of MemoClosure that allows the construction of one or more indexes to provide rapid
access to the items in the sequence.
There can be multiple indexes (a) because different expressions
are used in filter predicates on this value, and (b) because of the problems of matching untyped atomic
values. In an expression such as $seq[./A = $B], one index is built for each primitive type that occurs in the
sequence $B. In this index, any untyped atomic values in ./A are converted to that primitive type. For an expression
such as $seq[./A eq $B], a single index is built, in which untyped atomic values in ./A are converted to strings.
A particular difficulty arises where $B (in the expression $seq[./A eq $B]) is untypedAtomic. In this situation
an index is built in which any untypedAtomic values in ./A are indexed as strings. While building the index, we
note all the primitive types that occur in ./A, and then we convert the search term $B to each of these types in turn
before doing the index lookup. In practice, of course, it is very rare for the index to be heterogeneous.
- See Also:
- Serialized Form
Methods inherited from class net.sf.saxon.value.Value |
asItem, asIterator, asValue, checkPermittedContents, convert, convertJavaObjectToXPath, convertToJava, effectiveBooleanValue, equals, evaluateAsString, evaluateItem, getDependencies, getIterator, getParentExpression, getStringValue, getStringValueCS, hashCode, iterateSubExpressions, makeQNameValue, optimize, promote, simplify, stringToNumber, toString, typeCheck |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
IndexedClosure
public IndexedClosure()
isIndexable
public boolean isIndexable()
- Determine wither this Closure is indexable
- Overrides:
isIndexable
in class Closure
findItems
public SequenceIterator findItems(Expression use,
SequenceIterator values,
boolean convertUntypedToOther,
AtomicComparer comparer,
XPathContext context)
throws XPathException
- Retrieve items that match a given index value
- Parameters:
use
- the expression whose value is to be matchedvalues
- the set of values to be foundconvertUntypedToOther
- true if untypedAtomic values are to be converted to the
type of the other operandcomparer
- AtomicComparer used to compare values for equality (encapsulates a collation
if necessary)context
- the dynamic evaluation context
- Returns:
- an iterator over the items that match the specified values
- Throws:
XPathException
materialize
public Value materialize()
throws XPathException
- Return a value containing all the items in the sequence returned by this
SequenceIterator
- Overrides:
materialize
in class MemoClosure
- Returns:
- the corresponding value
- Throws:
XPathException