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 classAggregateDataCollecting.NullCollectionModeNULL values collection mode.
-
Field Summary
Fields Modifier and Type Field Description private booleandistinctprivate AggregateDataCollecting.NullCollectionModenullCollectionModeprivate booleanorderedWithOrderprivate Valueshared(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) voidadd(SessionLocal session, Value v)Add a value to this aggregate.(package private) Value[]getArray()Returns array with values ornull.(package private) intgetCount()Returns the count of values.(package private) ValuegetSharedArgument()Returns value of a shared argument.(package private) ValuegetValue(SessionLocal session)Get the aggregate result.private booleanisNull(Value v)java.util.Iterator<Value>iterator()(package private) voidsetSharedArgument(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:AggregateDataAdd a value to this aggregate.- Specified by:
addin classAggregateData- Parameters:
session- the sessionv- the value
-
isNull
private boolean isNull(Value v)
-
getValue
Value getValue(SessionLocal session)
Description copied from class:AggregateDataGet the aggregate result.- Specified by:
getValuein 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:
iteratorin 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
-
-