com.saxonica.deploy
Class CompiledMemoClosure

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

public class CompiledMemoClosure
extends CompiledClosure

A CompiledMemoClosure is a closure that remembers the input values once they have been read the first time. It is similar in operation to the MemoClosure class used by the interpreter.

See Also:
Serialized Form

Nested Class Summary
 class CompiledMemoClosure.ProgressiveIterator
          A ProgressiveIterator starts by reading any items already held in the reservoir; when the reservoir is exhausted, it reads further items from the inputIterator, copying them into the reservoir as they are read.
 
Field Summary
protected static int EMPTY
           
protected  int state
           
 
Fields inherited from class com.saxonica.deploy.CompiledClosure
cardinality, inputIterator, primitiveType
 
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
CompiledMemoClosure(CompiledClosure input)
           
CompiledMemoClosure(SequenceIterator inputIterator, int primitiveType, int cardinality)
           
 
Method Summary
 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()
          Evaluate the expression in a given context to return an iterator over a sequence
 
Methods inherited from class com.saxonica.deploy.CompiledClosure
getCardinality, getItemType, getSchemaComparable, reduce
 
Methods inherited from class net.sf.saxon.value.Value
asItem, asItem, asIterator, asValue, checkPermittedContents, convertToJava, effectiveBooleanValue, equals, fromItem, getCanonicalLexicalRepresentation, getIterator, getStringValue, getStringValueCS, hashCode, isIdentical, iterate, process
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

state

protected int state

EMPTY

protected static final int EMPTY
See Also:
Constant Field Values
Constructor Detail

CompiledMemoClosure

public CompiledMemoClosure(SequenceIterator inputIterator,
                           int primitiveType,
                           int cardinality)

CompiledMemoClosure

public CompiledMemoClosure(CompiledClosure input)
Method Detail

iterate

public SequenceIterator iterate()
                         throws XPathException
Evaluate the expression in a given context to return an iterator over a sequence

Overrides:
iterate in class CompiledClosure
Returns:
an iterator over the sequence of items
Throws:
XPathException - if a dynamic error occurs. This is possible only in the case of values that are materialized lazily, that is, where the iterate() method leads to computation of an expression that delivers the values.

itemAt

public Item itemAt(int n)
            throws XPathException
Description copied from class: Value
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 CompiledClosure
Returns:
the number of items in the sequence
Throws:
XPathException


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