MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

ch.ethz.mxquery.model
Class Iterator

java.lang.Object
  extended by ch.ethz.mxquery.model.Iterator
All Implemented Interfaces:
XDMIterator, Traversable
Direct Known Subclasses:
BlockDeclIterator, CurrentBasedIterator, FTContainsIterator, GroupByIndexIterator, ResultDataIterator, RewriteExpression, TokenBasedIterator, TokenSequenceIterator, UpdateIterator, Window, WrapperIterator, XDMImportAdapter

public abstract class Iterator
extends java.lang.Object
implements XDMIterator


Field Summary
 
Fields inherited from interface ch.ethz.mxquery.model.XDMIterator
EXPR_CATEGORY_SEQUENTIAL, EXPR_CATEGORY_SIMPLE, EXPR_CATEGORY_UPDATING, EXPR_CATEGORY_VACUOUS, EXPR_PARAM_CHEAPEVAL, EXPR_PARAM_VARIABLE, EXPR_PARAM_WINDOW, EXPR_PARAM_XDMGEN
 
Constructor Summary
Iterator(Context ctx, int minExpected, XDMIterator[] subIters, QueryLocation location)
           
Iterator(Context ctx, QueryLocation location)
           
Iterator(Context ctx, XDMIterator[] subIters, int expected, QueryLocation location)
           
Iterator(Context ctx, XDMIterator[] subIters, QueryLocation location)
           
 
Method Summary
 void addPredicates(Iterator[] predIters)
           
 void close(boolean restartable)
          Frees the state of the iterator and all subiterators.
 XDMIterator copy(Context parentIterContext, XQStaticContext prevParentIterContext, boolean copyContext, java.util.Vector nestedPredCtxStack)
          Copies the Iterator.
static int[] copyInts(int[] ints)
           
static XDMIterator[] copyIterators(Context context, XDMIterator[] iters, java.util.Vector nestedPredCtxStack)
           
static QName[] copyQNames(QName[] qnames)
           
static java.lang.String[] copyStrings(java.lang.String[] strings)
           
static TypeInfo[] copyTypeInfos(TypeInfo[] infos)
           
 XDMIterator[] getAllSubIters()
           
 java.util.Vector getAllSubItersRecursive()
           
 Context getContext()
          Retrieve the (unified) context of this iterators, carrying both dynamic and static information
 int getExpressionCategoryType(boolean scripting)
          Get and (check) the expression category type, as defined in the XQSF draft Expression categories are: SIMPLE, UPDATING, SEQUENTIAL, VACUOUS If the categories are incompatible, the related exception is thrown The check is only done when requested by calling this function The implementation covers the common case (simple expressions, no checking) and needs to be overwritten for checking and also by updating, sequential and vacuous expressions
 QueryLocation getLoc()
          Get the location in the XQuery source where this operator comes from
 PendingUpdateList getPendingUpdateList()
          Returns the complete Pending Update List (PUL) of this iterator.
 Iterator[] getPredicates()
           
 TypeInfo getStaticType()
          Return the return type if it can be statically determined
 XDMIterator[] getSubIters()
           
 boolean hasPredicates()
           
 boolean isConstModePreserve()
           
 boolean isExprParameter(int valueToCheck, boolean recursive)
          Optimization check
 boolean isOpen()
           
 boolean isResettable()
          Retrieve if this iterator is resetable
 void removePredicates()
           
 void reset()
          Resets the Iterator to its original state, without discarding expensive state
 void setConstModePreserve(boolean constModePreserve)
           
 void setContext(Context context, boolean recursive)
          Assigns a context for this iterator (and possibly for its subIterators), replacing the existing context
 void setLoc(QueryLocation loc)
          Set the location in the XQuery source where this operator comes from
 void setOrderByExpr(XDMIterator orderByExpr)
           
 void setParam(java.lang.String name, java.lang.String value)
           
 void setResettable(boolean r)
          Set this Iterator (and its subiterators) resetable.
 void setReturnExpr(XDMIterator retExpr)
           
 void setSubIters(java.util.Vector subIt)
           
 void setSubIters(XDMIterator subIt)
           
 void setSubIters(XDMIterator[] subIt)
           
 void setWhereExpr(XDMIterator whereExpr)
           
 KXmlSerializer traverse(KXmlSerializer serializer)
           
 KXmlSerializer traverseIteratorTree(KXmlSerializer serializer)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.ethz.mxquery.model.XDMIterator
next
 

Constructor Detail

Iterator

public Iterator(Context ctx,
                QueryLocation location)

Iterator

public Iterator(Context ctx,
                int minExpected,
                XDMIterator[] subIters,
                QueryLocation location)
         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

Iterator

public Iterator(Context ctx,
                XDMIterator[] subIters,
                int expected,
                QueryLocation location)
         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

Iterator

public Iterator(Context ctx,
                XDMIterator[] subIters,
                QueryLocation location)
Method Detail

addPredicates

public void addPredicates(Iterator[] predIters)

getPredicates

public Iterator[] getPredicates()

removePredicates

public void removePredicates()

hasPredicates

public boolean hasPredicates()

setContext

public void setContext(Context context,
                       boolean recursive)
                throws MXQueryException
Description copied from interface: XDMIterator
Assigns a context for this iterator (and possibly for its subIterators), replacing the existing context

Specified by:
setContext in interface XDMIterator
Parameters:
context - the context to assign
recursive - true perform the assignment also subiteratos, false only replace on the current iterator
Throws:
MXQueryException

setSubIters

public void setSubIters(java.util.Vector subIt)

setSubIters

public void setSubIters(XDMIterator[] subIt)
                 throws MXQueryException
Specified by:
setSubIters in interface XDMIterator
Throws:
MXQueryException

setSubIters

public void setSubIters(XDMIterator subIt)
Specified by:
setSubIters in interface XDMIterator

getSubIters

public XDMIterator[] getSubIters()
                          throws MXQueryException
Specified by:
getSubIters in interface XDMIterator
Throws:
MXQueryException

setReturnExpr

public void setReturnExpr(XDMIterator retExpr)

setOrderByExpr

public void setOrderByExpr(XDMIterator orderByExpr)

setWhereExpr

public void setWhereExpr(XDMIterator whereExpr)

setParam

public void setParam(java.lang.String name,
                     java.lang.String value)
              throws MXQueryException
Throws:
MXQueryException

getContext

public Context getContext()
Description copied from interface: XDMIterator
Retrieve the (unified) context of this iterators, carrying both dynamic and static information

Specified by:
getContext in interface XDMIterator
Returns:
a Context object

setResettable

public void setResettable(boolean r)
                   throws MXQueryException
Description copied from interface: XDMIterator
Set this Iterator (and its subiterators) resetable. Resetable iterators may require more space (trading buffered data against recomputation)

Specified by:
setResettable in interface XDMIterator
Parameters:
r - true make this iterator resetable, false make it not resetable
Throws:
MXQueryException

isResettable

public boolean isResettable()
                     throws MXQueryException
Description copied from interface: XDMIterator
Retrieve if this iterator is resetable

Specified by:
isResettable in interface XDMIterator
Returns:
true this iterator is resetable, false it is not
Throws:
MXQueryException

isExprParameter

public boolean isExprParameter(int valueToCheck,
                               boolean recursive)
Description copied from interface: XDMIterator
Optimization check

Specified by:
isExprParameter in interface XDMIterator
Returns:
if iterator fulfills the requested criteria

reset

public final void reset()
                 throws MXQueryException
Description copied from interface: XDMIterator
Resets the Iterator to its original state, without discarding expensive state

Specified by:
reset in interface XDMIterator
Throws:
MXQueryException

close

public final void close(boolean restartable)
                 throws MXQueryException
Description copied from interface: XDMIterator
Frees the state of the iterator and all subiterators.

Specified by:
close in interface XDMIterator
Parameters:
restartable - make the iterator restartable (otherwise the iterator will stay closed with additional next calls)
Throws:
MXQueryException

getStaticType

public TypeInfo getStaticType()
Description copied from interface: XDMIterator
Return the return type if it can be statically determined

Specified by:
getStaticType in interface XDMIterator
Returns:
a Type info carrying the most precise static type that could be determined. If no specific type could be determined, the type is ITEM*

getExpressionCategoryType

public int getExpressionCategoryType(boolean scripting)
                              throws MXQueryException
Description copied from interface: XDMIterator
Get and (check) the expression category type, as defined in the XQSF draft Expression categories are: SIMPLE, UPDATING, SEQUENTIAL, VACUOUS If the categories are incompatible, the related exception is thrown The check is only done when requested by calling this function The implementation covers the common case (simple expressions, no checking) and needs to be overwritten for checking and also by updating, sequential and vacuous expressions

Specified by:
getExpressionCategoryType in interface XDMIterator
Parameters:
scripting - TODO
Returns:
the most stringent expression type
Throws:
MXQueryException

getAllSubIters

public XDMIterator[] getAllSubIters()
Specified by:
getAllSubIters in interface XDMIterator

getAllSubItersRecursive

public java.util.Vector getAllSubItersRecursive()
Specified by:
getAllSubItersRecursive in interface XDMIterator

traverseIteratorTree

public KXmlSerializer traverseIteratorTree(KXmlSerializer serializer)
                                    throws java.lang.Exception
Specified by:
traverseIteratorTree in interface XDMIterator
Throws:
java.lang.Exception

traverse

public KXmlSerializer traverse(KXmlSerializer serializer)
Specified by:
traverse in interface Traversable

isOpen

public boolean isOpen()
Specified by:
isOpen in interface XDMIterator

getPendingUpdateList

public PendingUpdateList getPendingUpdateList()
                                       throws MXQueryException
Description copied from interface: XDMIterator
Returns the complete Pending Update List (PUL) of this iterator. Is null for non-updating expressions. Since the PUL is computed gradually (especially in a scripting environment, this function should only be called when the evaluation is complete. For scripting, this function also merges the PULs of the child iterators, so

Specified by:
getPendingUpdateList in interface XDMIterator
Returns:
pending update list
Throws:
MXQueryException

copy

public XDMIterator copy(Context parentIterContext,
                        XQStaticContext prevParentIterContext,
                        boolean copyContext,
                        java.util.Vector nestedPredCtxStack)
                 throws MXQueryException
Description copied from interface: XDMIterator
Copies the Iterator. The context is copied (if necessary) here. The subIterators are copied (if existing) here.

Specified by:
copy in interface XDMIterator
Parameters:
parentIterContext - The new parent context
prevParentIterContext - The previous context of the parent iterator
copyContext - Copy the context or use the parent context
nestedPredCtxStack - The Stack of nested predicate context, needed for nested rewritten predicates
Returns:
A copy of this Iterator
Throws:
MXQueryException

copyIterators

public static XDMIterator[] copyIterators(Context context,
                                          XDMIterator[] iters,
                                          java.util.Vector nestedPredCtxStack)
                                   throws MXQueryException
Throws:
MXQueryException

copyStrings

public static java.lang.String[] copyStrings(java.lang.String[] strings)

copyInts

public static int[] copyInts(int[] ints)

copyTypeInfos

public static TypeInfo[] copyTypeInfos(TypeInfo[] infos)

copyQNames

public static QName[] copyQNames(QName[] qnames)

getLoc

public QueryLocation getLoc()
Description copied from interface: XDMIterator
Get the location in the XQuery source where this operator comes from

Specified by:
getLoc in interface XDMIterator
Returns:
the QueryLocation object representing the location

setLoc

public void setLoc(QueryLocation loc)
Description copied from interface: XDMIterator
Set the location in the XQuery source where this operator comes from

Specified by:
setLoc in interface XDMIterator
Parameters:
loc - the QueryLocation object representing the location

isConstModePreserve

public boolean isConstModePreserve()
Specified by:
isConstModePreserve in interface XDMIterator

setConstModePreserve

public void setConstModePreserve(boolean constModePreserve)
Specified by:
setConstModePreserve in interface XDMIterator

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich