MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

ch.ethz.mxquery.model
Class Window

java.lang.Object
  extended by ch.ethz.mxquery.model.Iterator
      extended by ch.ethz.mxquery.model.Window
All Implemented Interfaces:
IndexIterator, XDMIterator, Traversable
Direct Known Subclasses:
LLStoreIterator, WindowIterator

public abstract class Window
extends Iterator
implements IndexIterator

A window iterator works always on a store, which materializes the tokens. A window can either be a window with a start and end edge or (also the name states something else) selected items form the store.


Field Summary
static int END_OF_STREAM_NODE
           
static int 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
Window()
           
 
Method Summary
abstract  void destroyWindow()
          Destroys the connection to the window buffer and gives the used item free for garbage collection
abstract  boolean equals(java.lang.Object other)
           
 int getEndPosition()
           
 Window getNewEarlyParallelWindowInterface(int startPosition, WindowVariable[] startVars, VariableHolder[] startVarHolders, XDMIterator endExpr, WindowVariable[] endVars, VariableHolder[] endVarHolders)
           
 Window getNewEarlyWindowInterface(int startPosition, XDMIterator startExpr, WindowVariable[] startVars, VariableHolder[] startVarHolders, XDMIterator endExpr, WindowVariable[] endVars, VariableHolder[] endVarHolders)
           
abstract  Window getNewItemWindow(IntegerList values)
          Returns a new iterator consisting of the given items in the integer list.
abstract  Window getNewWindow(int startPosition, int endPosition)
          Returns a new iterator for a given start and end position.
 int getNextWindowStartPosition()
           
abstract  int getPosition()
           
abstract  int getStartNode()
          Returns the first node id of the window
abstract  Source getStore()
           
 Window getUnderlyingWindow()
           
abstract  int getWindowId()
          Every window has a unique id given by the buffer the window is working on.
 void increasePosition()
           
 boolean isExprParameter(int valueToCheck, boolean recursive)
          Optimization check
 boolean isWindow()
           
abstract  boolean isWindowInUse()
          If a window is not in use it is a schema for other windows.
 Token jumpToNextAttribute(java.lang.String attributeName)
          Jumps to the next attribute if possible in the form of /@attributeName If the jump is not possible, -1 is returned
 void setPosition(int p)
           
abstract  void setWindowInUse(boolean windowInUse)
          Specifies if a window can be used again.
 
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, setContext, setLoc, setOrderByExpr, setParam, setResettable, setReturnExpr, setSubIters, setSubIters, setSubIters, setWhereExpr, traverse, traverseIteratorTree
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.ethz.mxquery.model.IndexIterator
getItem, hasItem, hasNextItem, nextItem
 
Methods inherited from interface ch.ethz.mxquery.model.XDMIterator
next
 

Field Detail

END_OF_STREAM_POSITION

public static final int END_OF_STREAM_POSITION
See Also:
Constant Field Values

END_OF_STREAM_NODE

public static final int END_OF_STREAM_NODE
See Also:
Constant Field Values
Constructor Detail

Window

public Window()
Method Detail

getUnderlyingWindow

public Window getUnderlyingWindow()
                           throws MXQueryException
Throws:
MXQueryException

getNewItemWindow

public abstract Window getNewItemWindow(IntegerList values)
                                 throws MXQueryException
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.

Parameters:
values - Each value in the integer list has to be a position
Returns:
a new Window for the given list of positions
Throws:
MXQueryException

getNewEarlyWindowInterface

public Window getNewEarlyWindowInterface(int startPosition,
                                         XDMIterator startExpr,
                                         WindowVariable[] startVars,
                                         VariableHolder[] startVarHolders,
                                         XDMIterator endExpr,
                                         WindowVariable[] endVars,
                                         VariableHolder[] endVarHolders)

getNewEarlyParallelWindowInterface

public Window getNewEarlyParallelWindowInterface(int startPosition,
                                                 WindowVariable[] startVars,
                                                 VariableHolder[] startVarHolders,
                                                 XDMIterator endExpr,
                                                 WindowVariable[] endVars,
                                                 VariableHolder[] endVarHolders)

jumpToNextAttribute

public Token jumpToNextAttribute(java.lang.String attributeName)
                          throws MXQueryException
Jumps to the next attribute if possible in the form of /@attributeName If the jump is not possible, -1 is returned

Parameters:
attributeName -
Returns:
The event id
Throws:
MXQueryException

getNewWindow

public abstract Window getNewWindow(int startPosition,
                                    int endPosition)
                             throws MXQueryException
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

Parameters:
startPosition -
endPosition -
Returns:
a new window for the given start and end positions
Throws:
MXQueryException

getStartNode

public abstract int getStartNode()
                          throws MXQueryException
Returns the first node id of the window

Returns:
returns the first node id of this window
Throws:
MXQueryException

destroyWindow

public abstract void destroyWindow()
Destroys the connection to the window buffer and gives the used item free for garbage collection


equals

public abstract boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

getWindowId

public abstract int getWindowId()
Every window has a unique id given by the buffer the window is working on.

Returns:
the identifier of this window

isWindowInUse

public abstract boolean isWindowInUse()
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

Returns:
true if the window is use, false otherwise

setWindowInUse

public abstract void setWindowInUse(boolean windowInUse)
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.

Parameters:
windowInUse -

increasePosition

public void increasePosition()

setPosition

public void setPosition(int p)

getPosition

public abstract int getPosition()

isWindow

public boolean isWindow()

isExprParameter

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

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

getEndPosition

public int getEndPosition()

getNextWindowStartPosition

public int getNextWindowStartPosition()

getStore

public abstract Source getStore()

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich