xxl.relational
Class Grouper

java.lang.Object
  |
  +--xxl.relational.AbstractResultSet
        |
        +--xxl.relational.Grouper
Direct Known Subclasses:
NestedLoopsGrouper, SortBasedGrouper

public abstract class Grouper
extends AbstractResultSet

This abstract class represents the logical Operator "Grouper".

It provides methods for metadata, that are equal for all subclasses of Grouper. Aggregate functions are also implemented and they can be used in the constructor. Aggregate function f must have the following syntax: f.invoke() returns a ResultSetMetaData-Object, that represents the metadata for this aggregate column like a ResultSet that has only one column. f.invoke(columnValue, intermediate_value) aggregates the columnValue with an intermediate_value to another intermediate_value. If columnvalue is null, the original intermediate_value is returned. If intermediate_value is null and columnvalue is not null, an initial intermediate_value is computed from the columnvalue. f.invoke(intermediate_value) returns the real aggregate value, that ist computed from the intermediate_value. If intermediate_value is null, the default aggregate value is returned. Example for Grouper: Grouper (new String{" select Boss, count(Name) ... to be continued ...


Field Summary
protected  Function[] aggregates
           
static Function AVG
           
protected  int[] byColumns
           
static Function COUNT
           
static Function COUNT_ALL
           
protected  int length
           
static Function MAX
           
protected  java.sql.ResultSetMetaData metaData
           
static Function MIN
           
protected  int[] onColumns
           
protected  java.sql.ResultSet projectedResultSet
           
protected  int projLength
           
protected  java.sql.ResultSet resultSet
           
static Function SUM
           
 
Constructor Summary
Grouper(int[] byColumns, Function[] aggregates, int[] onColumns, java.sql.ResultSet resultSet)
           
Grouper(int[] byColumns, Function[] aggregates, java.lang.String[] onColumns, java.sql.ResultSet resultSet)
           
Grouper(java.lang.String[] byColumns, Function[] aggregates, int[] onColumns, java.sql.ResultSet resultSet)
           
Grouper(java.lang.String[] byColumns, Function[] aggregates, java.lang.String[] onColumns, java.sql.ResultSet resultSet)
           
 
Method Summary
abstract  void close()
           
protected  void createGrouper(int[] byColumns, Function[] aggregates, int[] onColumns, java.sql.ResultSet resultSet)
           
 int findColumn(java.lang.String columnName)
           
abstract  byte[] getBytes(int columnIndex)
           
 java.sql.ResultSetMetaData getMetaData()
           
abstract  java.lang.Object getObject(int columnIndex)
           
abstract  boolean next()
           
abstract  boolean wasNull()
           
 
Methods inherited from class xxl.relational.AbstractResultSet
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getColumnCount, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getInt, getInt, getLong, getLong, getObject, getObject, getObject, getRef, getRef, getRow, getShort, getShort, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COUNT

public static final Function COUNT

COUNT_ALL

public static final Function COUNT_ALL

SUM

public static final Function SUM

MIN

public static final Function MIN

MAX

public static final Function MAX

AVG

public static final Function AVG

resultSet

protected java.sql.ResultSet resultSet

projectedResultSet

protected java.sql.ResultSet projectedResultSet

metaData

protected java.sql.ResultSetMetaData metaData

byColumns

protected int[] byColumns

aggregates

protected Function[] aggregates

onColumns

protected int[] onColumns

projLength

protected int projLength

length

protected int length
Constructor Detail

Grouper

public Grouper(int[] byColumns,
               Function[] aggregates,
               int[] onColumns,
               java.sql.ResultSet resultSet)

Grouper

public Grouper(java.lang.String[] byColumns,
               Function[] aggregates,
               int[] onColumns,
               java.sql.ResultSet resultSet)

Grouper

public Grouper(int[] byColumns,
               Function[] aggregates,
               java.lang.String[] onColumns,
               java.sql.ResultSet resultSet)

Grouper

public Grouper(java.lang.String[] byColumns,
               Function[] aggregates,
               java.lang.String[] onColumns,
               java.sql.ResultSet resultSet)
Method Detail

createGrouper

protected void createGrouper(int[] byColumns,
                             Function[] aggregates,
                             int[] onColumns,
                             java.sql.ResultSet resultSet)

next

public abstract boolean next()
                      throws java.sql.SQLException
Overrides:
next in class AbstractResultSet

close

public abstract void close()
                    throws java.sql.SQLException
Overrides:
close in class AbstractResultSet

getObject

public abstract java.lang.Object getObject(int columnIndex)
                                    throws java.sql.SQLException
Overrides:
getObject in class AbstractResultSet

getBytes

public abstract byte[] getBytes(int columnIndex)
                         throws java.sql.SQLException
Overrides:
getBytes in class AbstractResultSet

wasNull

public abstract boolean wasNull()
                         throws java.sql.SQLException
Overrides:
wasNull in class AbstractResultSet

findColumn

public int findColumn(java.lang.String columnName)
               throws java.sql.SQLException
Overrides:
findColumn in class AbstractResultSet

getMetaData

public java.sql.ResultSetMetaData getMetaData()
                                       throws java.sql.SQLException
Overrides:
getMetaData in class AbstractResultSet