Package org.h2.expression.aggregate
Class AggregateDataCollecting
- java.lang.Object
-
- org.h2.expression.aggregate.AggregateData
-
- org.h2.expression.aggregate.AggregateDataCollecting
-
- All Implemented Interfaces:
java.lang.Iterable<Value>
final class AggregateDataCollecting extends AggregateData implements java.lang.Iterable<Value>
Data stored while calculating an aggregate that needs collecting of all values or a distinct aggregate.NULL values are not collected.
getValue(SessionLocal)
method returnsnull
. UsegetArray()
for instances of this class instead.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
AggregateDataCollecting.NullCollectionMode
NULL values collection mode.
-
Field Summary
Fields Modifier and Type Field Description private boolean
distinct
private AggregateDataCollecting.NullCollectionMode
nullCollectionMode
private boolean
orderedWithOrder
private Value
shared
(package private) java.util.Collection<Value>
values
-
Constructor Summary
Constructors Constructor Description AggregateDataCollecting(boolean distinct, boolean orderedWithOrder, AggregateDataCollecting.NullCollectionMode nullCollectionMode)
Creates new instance of data for collecting aggregates.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
add(SessionLocal session, Value v)
Add a value to this aggregate.(package private) Value[]
getArray()
Returns array with values ornull
.(package private) int
getCount()
Returns the count of values.(package private) Value
getSharedArgument()
Returns value of a shared argument.(package private) Value
getValue(SessionLocal session)
Get the aggregate result.private boolean
isNull(Value v)
java.util.Iterator<Value>
iterator()
(package private) void
setSharedArgument(Value shared)
Sets value of a shared argument.
-
-
-
Field Detail
-
distinct
private final boolean distinct
-
orderedWithOrder
private final boolean orderedWithOrder
-
nullCollectionMode
private final AggregateDataCollecting.NullCollectionMode nullCollectionMode
-
values
java.util.Collection<Value> values
-
shared
private Value shared
-
-
Constructor Detail
-
AggregateDataCollecting
AggregateDataCollecting(boolean distinct, boolean orderedWithOrder, AggregateDataCollecting.NullCollectionMode nullCollectionMode)
Creates new instance of data for collecting aggregates.- Parameters:
distinct
- if distinct is usedorderedWithOrder
- if aggregate is an ordered aggregate with ORDER BY clausenullCollectionMode
- NULL values collection mode
-
-
Method Detail
-
add
void add(SessionLocal session, Value v)
Description copied from class:AggregateData
Add a value to this aggregate.- Specified by:
add
in classAggregateData
- Parameters:
session
- the sessionv
- the value
-
isNull
private boolean isNull(Value v)
-
getValue
Value getValue(SessionLocal session)
Description copied from class:AggregateData
Get the aggregate result.- Specified by:
getValue
in classAggregateData
- Parameters:
session
- the session- Returns:
- the value
-
getCount
int getCount()
Returns the count of values.- Returns:
- the count of values
-
getArray
Value[] getArray()
Returns array with values ornull
.- Returns:
- array with values or
null
-
iterator
public java.util.Iterator<Value> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<Value>
-
setSharedArgument
void setSharedArgument(Value shared)
Sets value of a shared argument.- Parameters:
shared
- the shared value
-
getSharedArgument
Value getSharedArgument()
Returns value of a shared argument.- Returns:
- value of a shared argument
-
-