MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

ch.ethz.mxquery.bindings
Class WindowBuffer

java.lang.Object
  extended by ch.ethz.mxquery.bindings.WindowBuffer
All Implemented Interfaces:
Source

public final class WindowBuffer
extends java.lang.Object
implements Source

Based on a TokenBuffer this class is a factory for window iterators. Each window iterator which uses the same WindowBuffer operates on the same materialized stream. Additionally this class provides some access functionalities for window iterators.
Important definitions:
item: Is a item in a sequence
position: Position as in XQuery. First position is 1.
nodeId: Like Position but starting with 0
tokenId: Id of each token. Also starting with 0


Constructor Summary
WindowBuffer(StreamStore streamStore)
           
WindowBuffer(XDMIterator sourceIter, boolean sync, int size, int garbColl, boolean sameSchema)
           
WindowBuffer(XDMIterator sourceIter, boolean full_text, java.lang.String uri)
           
 
Method Summary
 int compare(Source store)
           
 WindowBuffer copy(Context context, java.util.Vector nestedPredCtxStack)
           
 Source copySource(Context ctx, java.util.Vector nestedPredCtxStack)
           
 StreamStore getBuffer()
           
 int getBufferId()
           
 WindowIterator getEmptySequence()
          Returns a emptySequence iterator.
 Window getIterator(Context ctx)
          Returns Iterator that points on the first token in the store.
 WindowEarlyBindingParallel getNewEarlyParallelWindowInterface(int startPosition, WindowVariable[] startVars, VariableHolder[] startVarHolders, XDMIterator endExpr, WindowVariable[] endVars, VariableHolder[] endVarHolders)
           
 WindowEarlyBinding getNewEarlyWindowInterface(int startPosition, XDMIterator startExpr, WindowVariable[] startVars, VariableHolder[] startVarHolders, XDMIterator endExpr, WindowVariable[] endVars, VariableHolder[] endVarHolders)
           
static Window getNewWindowInterface(XDMIterator sourceIter, int startPosition, int endPosition, boolean sync, int size, int garbColl, boolean sameSchema)
          This method returns a new Window Iterator.
 WindowIterator getNewWindowIterator(IntegerList positions)
          Return a new Window for the given positions
 WindowIterator getNewWindowIterator(int startPosition, int endPosition)
          Returns a new window iterator for the given range
 java.lang.String getURI()
          Returns the URI of the source.
 void setContext(Context context)
          Sets the context.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowBuffer

public WindowBuffer(StreamStore streamStore)

WindowBuffer

public WindowBuffer(XDMIterator sourceIter,
                    boolean sync,
                    int size,
                    int garbColl,
                    boolean sameSchema)
             throws MXQueryException
Throws:
MXQueryException

WindowBuffer

public WindowBuffer(XDMIterator sourceIter,
                    boolean full_text,
                    java.lang.String uri)
             throws MXQueryException
Throws:
MXQueryException
Method Detail

getBufferId

public int getBufferId()

getBuffer

public StreamStore getBuffer()

getEmptySequence

public WindowIterator getEmptySequence()
Returns a emptySequence iterator. Especially useful if you ask for a non existing node

Returns:
a WindowIterator representing an empty Sequence

getNewWindowIterator

public WindowIterator getNewWindowIterator(int startPosition,
                                           int endPosition)
Returns a new window iterator for the given range

Parameters:
startPosition -
endPosition -
Returns:
a WindowIterator for the specified range

getNewWindowIterator

public WindowIterator getNewWindowIterator(IntegerList positions)
Return a new Window for the given positions

Parameters:
positions -
Returns:
A WindowIterator representing the given positions

getNewEarlyWindowInterface

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

getNewEarlyParallelWindowInterface

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

setContext

public void setContext(Context context)
                throws MXQueryException
Sets the context. Especially used for external vars.

Parameters:
context -
Throws:
MXQueryException

getNewWindowInterface

public static Window getNewWindowInterface(XDMIterator sourceIter,
                                           int startPosition,
                                           int endPosition,
                                           boolean sync,
                                           int size,
                                           int garbColl,
                                           boolean sameSchema)
                                    throws MXQueryException
This method returns a new Window Iterator. If the underlying iterator is already a window iterator, the same window buffer is used. !!! Make sure that the sourceIter is reseted! Otherwise you might get strange results!

Parameters:
sourceIter -
startPosition -
endPosition -
sync -
size -
garbColl -
sameSchema -
Returns:
Creates a new Window for this iterator
Throws:
MXQueryException

copy

public WindowBuffer copy(Context context,
                         java.util.Vector nestedPredCtxStack)
                  throws MXQueryException
Throws:
MXQueryException

compare

public int compare(Source store)
Specified by:
compare in interface Source

copySource

public Source copySource(Context ctx,
                         java.util.Vector nestedPredCtxStack)
                  throws MXQueryException
Specified by:
copySource in interface Source
Throws:
MXQueryException

getIterator

public Window getIterator(Context ctx)
                   throws MXQueryException
Description copied from interface: Source
Returns Iterator that points on the first token in the store.

Specified by:
getIterator in interface Source
Returns:
Iterator a (Window) Iterator to access the contents of this source
Throws:
MXQueryException

getURI

public java.lang.String getURI()
Description copied from interface: Source
Returns the URI of the source.

Specified by:
getURI in interface Source
Returns:
a String representing the URI/Identifier of this source

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich