public class DBNumberStatistics extends DBNumber
Support DBvolution at Patreon
SORT_ASCENDING, SORT_DESCENDING| Constructor and Description |
|---|
DBNumberStatistics()
The default constructor for DBNumberStatistics.
|
DBNumberStatistics(IntegerExpression numberExpressionToGenerateStatsFrom)
Creates a column expression with a statistics result from the expression
provided.
|
DBNumberStatistics(NumberExpression numberExpressionToGenerateStatsFrom)
Creates a column expression with a statistics result from the expression
provided.
|
| Modifier and Type | Method and Description |
|---|---|
Number |
average()
The average value of the grouping.
|
DBNumberStatistics |
copy()
Copies a QueryableDatatype and returns the copy.
|
Number |
count()
Count of the rows included in this set of statistics
Support DBvolution at Patreon |
Number |
firstQuartile()
Support DBvolution at Patreon |
protected Number |
getFromResultSet(DBDefinition database,
ResultSet resultSet,
String fullColumnName)
Returns the correct object from the ResultSet for the QueryableDatatype to
handle.
|
protected Number |
getFromResultSet(DBDefinition database,
ResultSet resultSet,
String fullColumnName,
int offset) |
DBNumber |
getQueryableDatatypeForExpressionValue()
Provides a blank instance of the
QueryableDatatype used by this
expression. |
String |
getSQLDatatype()
Support DBvolution at Patreon |
boolean |
isAggregator()
Returns TRUE if this expression is an Aggregator like SUM() or LEAST().
|
Number |
max()
Support DBvolution at Patreon |
Number |
median()
The middle term in the grouping.
|
Number |
min()
Support DBvolution at Patreon |
Number |
secondQuartile()
The middle term in the grouping.
|
void |
setFromResultSet(DBDefinition database,
ResultSet resultSet,
String resultSetColumnName)
Used internally to set the QDT to the value returned from the database.
|
Number |
standardDeviation() |
Number |
sum()
Returns the sum of all the numbers in this group.
|
Number |
thirdQuartile()
Support DBvolution at Patreon |
String |
toString() |
doubleValue, excludedRange, excludedRange, excludedRangeExclusive, excludedRangeExclusive, excludedRangeInclusive, excludedRangeInclusive, excludedValues, excludedValues, excludedValues, formatValueForSQLStatement, getIncludesNull, getNumericPrecision, getNumericScale, getTablesInvolved, getValue, intValue, longValue, numberValue, permittedRange, permittedRange, permittedRangeExclusive, permittedRangeExclusive, permittedRangeInclusive, permittedRangeInclusive, permittedValues, permittedValues, permittedValues, setValue, setValue, setValueFromStandardStringEncoding, stringResultclear, equals, formatColumnForSQLStatement, getColumnExpression, getLiteralValue, getOperator, getPreviousSQLValue, getPreviousValue, getPropertyWrapperDefinition, getQueryableDatatypeForObject, getQueryableDatatypeInstance, getSortOrder, hasBeenSet, hasChanged, hasColumnExpression, hashCode, includingNulls, isDefined, isNotNull, isNull, isPurelyFunctional, negateOperator, removeConstraints, setChanged, setColumnExpression, setDefined, setLiteralValue, setOperator, setPreviousValue, setSortOrderAscending, setSortOrderDescending, setToNull, setToNull, setUnchanged, setValueToNull, stringValue, toSQLStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitisPurelyFunctional, toSQLStringpublic DBNumberStatistics()
Creates an unset undefined DBNumber object.
Use DBNumberStatistics(nz.co.gregs.dbvolution.expressions.NumberExpression) instead.
public DBNumberStatistics(NumberExpression numberExpressionToGenerateStatsFrom)
Used in DBReport, and some DBRow, sub-classes to derive
data from the database prior to retrieval.
numberExpressionToGenerateStatsFrom - numberExpressionpublic DBNumberStatistics(IntegerExpression numberExpressionToGenerateStatsFrom)
Used in DBReport, and some DBRow, sub-classes to derive
data from the database prior to retrieval.
numberExpressionToGenerateStatsFrom - numberExpressionpublic Number count()
Support DBvolution at Patreon
public Number sum()
Support DBvolution at Patreon
public Number min()
Support DBvolution at Patreon
public Number max()
Support DBvolution at Patreon
public Number median()
Support DBvolution at Patreon
public Number average()
Support DBvolution at Patreon
public Number firstQuartile()
Support DBvolution at Patreon
public Number thirdQuartile()
Support DBvolution at Patreon
public Number secondQuartile()
Support DBvolution at Patreon
public String getSQLDatatype()
DBNumberSupport DBvolution at Patreon
getSQLDatatype in class DBNumberpublic boolean isAggregator()
DBExpressionSubclasses must implement this method returning TRUE if the expression will combine the results of several rows to produce a result. If the expression relies on subexpressions, then the isAggregator method must return TRUE if the subexpressions include an aggregator.
Aggregators collect several rows together to produce a single result. Examples are MAX, MIN, and AVERAGE.
They are only appropriate in the SELECT clause and generally require the GROUP BY clause to be useful.
Aggregators are used with DBReport. Aggregator expressions are
included in the SELECT clause but excluded from the GROUP BY clause.
Support DBvolution at Patreon
isAggregator in interface DBExpressionisAggregator in class DBNumberpublic DBNumberStatistics copy()
QueryableDatatypeSupport DBvolution at Patreon
copy in interface DBExpressioncopy in interface NumberResultcopy in class DBNumberprotected Number getFromResultSet(DBDefinition database, ResultSet resultSet, String fullColumnName) throws SQLException
QueryableDatatypegetFromResultSet in class DBNumberdatabase - databaseresultSet - resultSetfullColumnName - fullColumnName
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionprotected Number getFromResultSet(DBDefinition database, ResultSet resultSet, String fullColumnName, int offset) throws SQLException
SQLExceptionpublic DBNumber getQueryableDatatypeForExpressionValue()
DBExpressionQueryableDatatype used by this
expression.
You are probably looking for ExpressionColumn.asExpressionColumn().
Note that this method is not good for use in everyday DBvolution code and should probably be reserved for meta-programming.
Support DBvolution at Patreon
getQueryableDatatypeForExpressionValue in interface DBExpressiongetQueryableDatatypeForExpressionValue in class DBNumberpublic void setFromResultSet(DBDefinition database, ResultSet resultSet, String resultSetColumnName) throws SQLException
QueryableDatatype
If you create a new QDT you should override this method. The default
implementation in QueryableDatatype processes the ResultSet column
as a String. You should follow the basic pattern but change
ResultSet.getString(String)
to the required ResultSet method and add any required post-processing.
Note that most of the method is dedicated to detecting NULL values. This is
very important as are the calls to QueryableDatatype.setUnchanged() and QueryableDatatype.setDefined(boolean)
setFromResultSet in class QueryableDatatype<Number>database - databaseresultSet - resultSetresultSetColumnName - resultSetColumnNameSQLException - Database exceptions may be thrownpublic String toString()
toString in class QueryableDatatype<Number>public Number standardDeviation()
Copyright © 2017. All Rights Reserved.