com.saxonica.extra
Class IndexedClosure

java.lang.Object
  extended bynet.sf.saxon.value.Value
      extended bynet.sf.saxon.value.Closure
          extended bynet.sf.saxon.value.MemoClosure
              extended bycom.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

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class net.sf.saxon.value.MemoClosure
MemoClosure.ProgressiveIterator
 
Field Summary
 
Fields inherited from class net.sf.saxon.value.MemoClosure
EMPTY, state
 
Fields inherited from class net.sf.saxon.value.Closure
depth, expression, inputIterator, savedXPathContext
 
Fields inherited from class net.sf.saxon.value.Value
EMPTY_CLASS_ARRAY
 
Fields inherited from interface net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
 
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
 
Constructor Summary
IndexedClosure()
           
 
Method Summary
 java.util.HashMap buildIndex(Expression use, XPathContext context)
          Build an index over the items in the sequence
 SequenceIterator findItems(Expression use, SequenceIterator values, XPathContext context)
          Retrieve items that match a given index value
 boolean isIndexable()
          Determine wither this Closure is indexable
 Value materialize()
          Return a value containing all the items in the sequence returned by this SequenceIterator
 
Methods inherited from class net.sf.saxon.value.MemoClosure
getLength, isFullyRead, itemAt, iterate, process
 
Methods inherited from class net.sf.saxon.value.Closure
display, getCardinality, getImplementationMethod, getItemType, getSpecialProperties, make, makeIteratorClosure, reduce
 
Methods inherited from class net.sf.saxon.value.Value
asItem, asIterator, asValue, checkPermittedContents, collapseWhitespace, convert, convertJavaObjectToXPath, convertToJava, effectiveBooleanValue, equals, evaluateAsString, evaluateItem, getDependencies, getIterator, getParentExpression, getStringValue, hashCode, iterateSubExpressions, makeQNameValue, normalizeWhitespace, optimize, promote, schemaEquals, simplify, stringToNumber, toString, trimWhitespace, typeCheck
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IndexedClosure

public IndexedClosure()
Method Detail

isIndexable

public boolean isIndexable()
Determine wither this Closure is indexable

Overrides:
isIndexable in class Closure

buildIndex

public java.util.HashMap buildIndex(Expression use,
                                    XPathContext context)
                             throws XPathException
Build an index over the items in the sequence

Parameters:
use - the expression returning the atomic values to act as the indexing keys
context - dynamic context for evaluating the indexing expression
Throws:
XPathException

findItems

public SequenceIterator findItems(Expression use,
                                  SequenceIterator values,
                                  XPathContext context)
                           throws XPathException
Retrieve items that match a given index value

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