MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

ch.ethz.mxquery.update.store.llImpl
Class LLStoreIterator

java.lang.Object
  extended by ch.ethz.mxquery.model.Iterator
      extended by ch.ethz.mxquery.model.Window
          extended by ch.ethz.mxquery.update.store.llImpl.LLStoreIterator
All Implemented Interfaces:
IndexIterator, XDMIterator, Traversable

public class LLStoreIterator
extends Window

Iterator hides the XML Store functionality and behaves like the Iterator from the MXQuery.


Field Summary
 
Fields inherited from class ch.ethz.mxquery.model.Window
END_OF_STREAM_NODE, END_OF_STREAM_POSITION
 
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
LLStoreIterator(Identifier startID, LLStore store)
          Constructor.
 
Method Summary
 void destroyWindow()
          Destroys the connection to the window buffer and gives the used item free for garbage collection
 boolean equals(java.lang.Object other)
           
 XDMIterator getItem(int position)
          Returns the item on the given Position.
 Window getNewItemWindow(IntegerList values)
          Returns a new iterator consisting of the given items in the integer list.
 Window getNewWindow(int startPosition, int endPosition)
          Returns a new iterator for a given start and end position.
 int getPosition()
           
 java.lang.String getSourceURI()
           
 int getStartNode()
          Returns the first node id of the window
 Source getStore()
           
 int getWindowId()
          Every window has a unique id given by the buffer the window is working on.
 int hashCode()
           
 boolean hasItem(int position)
          Checks if the given position is availabe
 boolean hasNextItem()
          Returns true if there is an item at all or if the actual item as a sibling.
 boolean isEmpty()
           
 boolean isWindowInUse()
          If a window is not in use it is a schema for other windows.
 Token next()
          Produces the next XDM token This method typically implements the base functionality of an Iterator and computes the value of the next token.
 XDMIterator nextItem()
          Returns the next item.
 void setContext(Context context, boolean recursive)
          Assigns a context for this iterator (and possibly for its subIterators), replacing the existing context
 void setWindowInUse(boolean windowInUse)
          Specifies if a window can be used again.
 
Methods inherited from class ch.ethz.mxquery.model.Window
getEndPosition, getNewEarlyParallelWindowInterface, getNewEarlyWindowInterface, getNextWindowStartPosition, getUnderlyingWindow, increasePosition, isExprParameter, isWindow, jumpToNextAttribute, setPosition
 
Methods inherited from class ch.ethz.mxquery.model.Iterator
addPredicates, close, copy, copyInts, copyIterators, copyQNames, copyStrings, copyTypeInfos, getAllSubIters, getAllSubItersRecursive, getContext, getExpressionCategoryType, getLoc, getPendingUpdateList, getPredicates, getStaticType, getSubIters, hasPredicates, isConstModePreserve, isOpen, isResettable, removePredicates, reset, setConstModePreserve, setLoc, setOrderByExpr, setParam, setResettable, setReturnExpr, setSubIters, setSubIters, setSubIters, setWhereExpr, traverse, traverseIteratorTree
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LLStoreIterator

public LLStoreIterator(Identifier startID,
                       LLStore store)
Constructor.

Parameters:
startID - the id of the node on which the iteration should start
store - store on which to generate the
Method Detail

next

public Token next()
           throws MXQueryException
Description copied from interface: XDMIterator
Produces the next XDM token This method typically implements the base functionality of an Iterator and computes the value of the next token.

Returns:
The XDM token representing the next fragment of the XDM instance
Throws:
MXQueryException

getStartNode

public int getStartNode()
                 throws MXQueryException
Description copied from class: Window
Returns the first node id of the window

Specified by:
getStartNode in class Window
Returns:
returns the first node id of this window
Throws:
MXQueryException

isEmpty

public boolean isEmpty()
                throws MXQueryException
Throws:
MXQueryException

getItem

public XDMIterator getItem(int position)
                    throws MXQueryException
Description copied from interface: IndexIterator
Returns the item on the given Position. If the item is not evailabe, an empty sequence item is returned

Parameters:
position - Position in the sequence (starting with 1)
Returns:
Item or empty sequence iterator
Throws:
MXQueryException

getNewWindow

public Window getNewWindow(int startPosition,
                           int endPosition)
                    throws MXQueryException
Description copied from class: Window
Returns a new iterator for a given start and end position. If the end is outside the underlying sequence the iterator throws no error but only returns items until the sequence ends

Specified by:
getNewWindow in class Window
Returns:
a new window for the given start and end positions
Throws:
MXQueryException

hasItem

public boolean hasItem(int position)
                throws MXQueryException
Description copied from interface: IndexIterator
Checks if the given position is availabe

Parameters:
position - Position in the sequence (starting with 1)
Returns:
True if the next item is not end_sequence otherwise false
Throws:
MXQueryException

hasNextItem

public boolean hasNextItem()
                    throws MXQueryException
Returns true if there is an item at all or if the actual item as a sibling.

Returns:
True if the next item is not end_sequence otherwise false
Throws:
MXQueryException

nextItem

public XDMIterator nextItem()
                     throws MXQueryException
Description copied from interface: IndexIterator
Returns the next item. If the item is not evailabe, an empty sequence item is returned

Returns:
Item or empty sequence iterator
Throws:
MXQueryException

setContext

public void setContext(Context context,
                       boolean recursive)
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
Overrides:
setContext in class Iterator
Parameters:
context - the context to assign
recursive - true perform the assignment also subiteratos, false only replace on the current iterator

destroyWindow

public void destroyWindow()
Description copied from class: Window
Destroys the connection to the window buffer and gives the used item free for garbage collection

Specified by:
destroyWindow in class Window

equals

public boolean equals(java.lang.Object other)
Specified by:
equals in class Window

getNewItemWindow

public Window getNewItemWindow(IntegerList values)
Description copied from class: Window
Returns a new iterator consisting of the given items in the integer list. If a position is outside the underlying sequence, the position is skipped.

Specified by:
getNewItemWindow in class Window
Parameters:
values - Each value in the integer list has to be a position
Returns:
a new Window for the given list of positions

getWindowId

public int getWindowId()
Description copied from class: Window
Every window has a unique id given by the buffer the window is working on.

Specified by:
getWindowId in class Window
Returns:
the identifier of this window

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isWindowInUse

public boolean isWindowInUse()
Description copied from class: Window
If a window is not in use it is a schema for other windows. E.g. a LET/FOR/FORSEQ binds a window to a variable the window is not in use yet. But in the moment the first variable reference is using the window the window is in used

Specified by:
isWindowInUse in class Window
Returns:
true if the window is use, false otherwise

setWindowInUse

public void setWindowInUse(boolean windowInUse)
Description copied from class: Window
Specifies if a window can be used again. This method is normally only used by the variable iterator. Be carefully with it, as it is mainly responsible to allow proper garbage collection.

Specified by:
setWindowInUse in class Window

getSourceURI

public java.lang.String getSourceURI()

getPosition

public int getPosition()
Specified by:
getPosition in class Window

getStore

public Source getStore()
Specified by:
getStore in class Window

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich