|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jagg.AggregateValue<T>
public class AggregateValue<T>
This class represents the result of a "group by" operation, where certain
fields of a type are selected for a "group by", and certain values can
be extracted by referring to Aggregators.
| Constructor Summary | |
|---|---|
AggregateValue(AggregateValue<T> other)
Create an AggregateValue using another
AggregateValue. |
|
AggregateValue(T object)
Create an AggregateValue that wraps the given object. |
|
| Method Summary | |
|---|---|
java.lang.Object |
getAggregateValue(Aggregator agg)
Retrieves the value for the given Aggregator. |
java.lang.Object |
getAggregateValue(int index)
Retrieves the value for the Aggregator at the given index. |
int |
getGroupingId(java.util.List<?> fields)
Determines the distinct grouping ID of the given referenced fields by determining whether each given referenced field represents "all values" in super-aggregation. |
T |
getObject()
Retrieves the T representing the "group-by" aggregation. |
java.lang.Object |
getPropertyValue(int propIndex)
Retrieves a property value representing a "group-by" category, with the property specified by a 0-based index into the original list of properties that was specified in Builder.getProperties. |
java.lang.Object |
getPropertyValue(java.lang.String property)
Retrieves a property value representing a "group-by" category by name. |
boolean |
isGrouping(int field)
Determines whether the referenced field represents the set of all values in a super-aggregate value. |
boolean |
isGrouping(java.lang.String propertyName)
Determines whether the referenced field represents the set of all values in a super-aggregate value. |
void |
setAggregateValue(Aggregator agg,
java.lang.Object value)
This method is used internally to store the given value
associated with the given Aggregator for later retrieval. |
java.lang.String |
toString()
Returns the string representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AggregateValue(T object)
AggregateValue that wraps the given object. It
will also store aggregation values.
object - The object for which this AggregateValue will
wrap.public AggregateValue(AggregateValue<T> other)
AggregateValue using another
AggregateValue. This will wrap the same object that the
other AggregateValue wraps.
other - Another AggregateValue.| Method Detail |
|---|
public T getObject()
Retrieves the T representing the "group-by" aggregation.
This method is used to directly access the property values, when
aggregating by calling Aggregation.groupByComparable.
If Aggregation.groupBy is called instead, then this
method will still succeed. However, if super-aggregation is used (cube,
rollups, grouping sets), the object returned here will not indicate that
this AggregateValue represents "all values" for a certain
property. In this case, either of the two overloaded
getPropertyValue methods will correctly return the
null value if that property represents "all values".
T object representing the "group-by" aggregation.Aggregation.groupByComparable(java.util.List) ,
getPropertyValue(String),
getPropertyValue(int)public java.lang.Object getPropertyValue(java.lang.String property)
Retrieves a property value representing a "group-by" category by name.
This method is used to access the property values, when aggregating by
calling Aggregation.groupBy after specifying "group-by"
properties. Because super-aggregation is possible in this case, if the
referenced property represents "all values", then this method will return
null instead of the actual property value.
property - The property name.
Aggregation.groupBy(java.util.List) public java.lang.Object getPropertyValue(int propIndex)
Retrieves a property value representing a "group-by" category, with
the property specified by a 0-based index into the original list of
properties that was specified in Builder.getProperties.
If Aggregation.groupByComparable was called, then there
are no "group-by" properties, so this method would return
null.
propIndex - The 0-based index into the list of properties.
public void setAggregateValue(Aggregator agg,
java.lang.Object value)
value
associated with the given Aggregator for later retrieval.
It also appends the given value to an internal list for
later retrieval by index.
agg - An Aggregator.value - The aggregated value.Aggregatorpublic java.lang.Object getAggregateValue(Aggregator agg)
Aggregator.
agg - An Aggregator.
null if no such
Aggregator is found.public java.lang.Object getAggregateValue(int index)
Aggregator at the given index.
index - The 0-based index.
java.lang.IndexOutOfBoundsException - If the index is out of range.public boolean isGrouping(int field)
Determines whether the referenced field represents the set of all
values in a super-aggregate value. This can be used to distinguish an
actual null value in normal aggregation vs. a
null that represents "all values" in super-aggregation.
For example, if there are 4 group-by properties, and super-aggregation is used, and this aggregate value happens to represent the grouping set {0, 1}, then properties 2 and 3 are "all values", and ...
isGrouping(0) == isGrouping(1) == false
isGrouping(2) == isGrouping(3) == true
field - A field reference integer, from 0 to n - 1, where
n is the the number of group-by properties.
true if the field represents "all values" in
super-aggregation, false otherwise.
java.lang.IllegalArgumentException - If the integer field reference is out of
range.public boolean isGrouping(java.lang.String propertyName)
Determines whether the referenced field represents the set of all
values in a super-aggregate value. This can be used to distinguish an
actual null value in normal aggregation vs. a
null that represents "all values" in super-aggregation.
For example, if there are 4 group-by properties ({"prop0", "prop1", "prop2", "prop3"}), and super-aggregation is used, and this aggregate value happens to represent the grouping set {0, 1}, then properties 2 and 3 are "all values", and ...
isGrouping("prop0") == isGrouping("prop1") == false
isGrouping("prop2") == isGrouping("prop3") == true
propertyName - A property name.
true if the field represents "all values" in
super-aggregation, false otherwise.
java.lang.IllegalArgumentException - If the property name is not a group-by
property.public int getGroupingId(java.util.List<?> fields)
Determines the distinct grouping ID of the given referenced fields by determining whether each given referenced field represents "all values" in super-aggregation.
For example, if there are 4 group-by properties ({"prop0", "prop1", "prop2", "prop3"}), and super-aggregation is used, and this aggregate value happens to represent the grouping set {0, 1}, then properties 2 and 3 are "all values", and ...
getGroupingId({0}) == getGroupingId({1}) == 0
getGroupingId({2}) == getGroupingId({3}) == 1
getGroupingId({0, 1}) == getGroupingId({1, 0}) == 0
getGroupingId({0, 2}) == getGroupingId({0, 3}) == 1
getGroupingId({1, 2}) == getGroupingId({1, 3}) == 1
getGroupingId({2, 0}) == getGroupingId({2, 1}) == 2
getGroupingId({3, 0}) == getGroupingId({3, 1}) == 2
getGroupingId({2, 3}) == getGroupingId({3, 2}) == 3
In the above examples, each integer n reference can be freely
substituted with the equivalent property name, e.g. 0 is
equivalent to "prop0".
fields - A List of field references, which can be
integer field references, from 0 to n - 1, where n
is the number of group-by properties, or they can be property names.
Each field reference maps to a bit in the returned number.
java.lang.IllegalArgumentException - If any of the fields represent integer
field references that are out of range, or they represent string
property names that aren't group-by properties.public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||