org.h2.expression.analysis

## Class WindowFrame

- java.lang.Object
- - org.h2.expression.analysis.WindowFrame

    public final class WindowFrame
    extends java.lang.Object

Window frame clause.

### Constructor Summary

Constructors
Constructor and Description
`WindowFrame(WindowFrameUnits units, WindowFrameBound starting, WindowFrameBound following, WindowFrameExclusion exclusion)` Creates new instance of window frame clause.

### Method Summary

Methods
`static int` `getEndIndex(Window over, Session session, java.util.ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow)` Returns end index for the specified frame, or default end index if frame is null.
`WindowFrameExclusion` `getExclusion()` Returns the exclusion clause.
`WindowFrameBound` `getFollowing()` Returns the following clause.
`java.lang.StringBuilder` `getSQL(java.lang.StringBuilder builder)` Append SQL representation to the specified builder.
`int` `getStartIndex(Session session, java.util.ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow)` Returns start index of this frame,
`WindowFrameBound` `getStarting()` Returns the starting clause.
`WindowFrameUnits` `getUnits()` Returns the units.
`boolean` `isValid()` Checks validity of this frame.
`boolean` `isVariableBounds()` Check if bounds of this frame has variable expressions.
`java.util.Iterator<Value[]>` `iterator(Session session, java.util.ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow, boolean reverse)` Returns iterator.
`static java.util.Iterator<Value[]>` `iterator(Window over, Session session, java.util.ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow, boolean reverse)` Returns iterator for the specified frame, or default iterator if frame is null.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### WindowFrame

    public WindowFrame(WindowFrameUnits units,
               WindowFrameBound starting,
               WindowFrameBound following,
               WindowFrameExclusion exclusion)

Creates new instance of window frame clause.

Parameters:
  `units` - units
  `starting` - starting clause
  `following` - following clause
  `exclusion` - exclusion clause

### Method Detail

#### iterator

    public static java.util.Iterator<Value[]> iterator(Window over,
                                       Session session,
                                       java.util.ArrayList<Value[]> orderedRows,
                                       SortOrder sortOrder,
                                       int currentRow,
                                       boolean reverse)

Returns iterator for the specified frame, or default iterator if frame is null.

Parameters:
  `over` - window
  `session` - the session
  `orderedRows` - ordered rows
  `sortOrder` - sort order
  `currentRow` - index of the current row
  `reverse` - whether iterator should iterate in reverse order
Returns:
  iterator

#### getEndIndex

    public static int getEndIndex(Window over,
                  Session session,
                  java.util.ArrayList<Value[]> orderedRows,
                  SortOrder sortOrder,
                  int currentRow)

Returns end index for the specified frame, or default end index if frame is null.

Parameters:
  `over` - window
  `session` - the session
  `orderedRows` - ordered rows
  `sortOrder` - sort order
  `currentRow` - index of the current row
Returns:
  end index
Throws:
  `java.lang.UnsupportedOperationException` - if over is not null and its exclusion clause is not EXCLUDE NO OTHERS

#### getUnits

    public WindowFrameUnits getUnits()

Returns the units.

Returns:
  the units

#### getStarting

    public WindowFrameBound getStarting()

Returns the starting clause.

Returns:
  the starting clause

#### getFollowing

    public WindowFrameBound getFollowing()

Returns the following clause.

Returns:
  the following clause, or null

#### getExclusion

    public WindowFrameExclusion getExclusion()

Returns the exclusion clause.

Returns:
  the exclusion clause

#### isValid

    public boolean isValid()

Checks validity of this frame.

Returns:
  whether bounds of this frame valid

#### isVariableBounds

    public boolean isVariableBounds()

Check if bounds of this frame has variable expressions. This method may be used only after `optimize(Session)` invocation.

Returns:
  if bounds of this frame has variable expressions

#### iterator

    public java.util.Iterator<Value[]> iterator(Session session,
                                       java.util.ArrayList<Value[]> orderedRows,
                                       SortOrder sortOrder,
                                       int currentRow,
                                       boolean reverse)

Returns iterator.

Parameters:
  `session` - the session
  `orderedRows` - ordered rows
  `sortOrder` - sort order
  `currentRow` - index of the current row
  `reverse` - whether iterator should iterate in reverse order
Returns:
  iterator

#### getStartIndex

    public int getStartIndex(Session session,
                    java.util.ArrayList<Value[]> orderedRows,
                    SortOrder sortOrder,
                    int currentRow)

Returns start index of this frame,

Parameters:
  `session` - the session
  `orderedRows` - ordered rows
  `sortOrder` - sort order
  `currentRow` - index of the current row
Returns:
  start index
Throws:
  `java.lang.UnsupportedOperationException` - if exclusion clause is not EXCLUDE NO OTHERS

#### getSQL

    public java.lang.StringBuilder getSQL(java.lang.StringBuilder builder)

Append SQL representation to the specified builder.

Parameters:
  `builder` - string builder
Returns:
  the specified string builder
See Also:
  `Expression.getSQL(StringBuilder)`