net.sf.jagg
Class Aggregation

java.lang.Object
  extended by net.sf.jagg.Aggregation

public class Aggregation
extends java.lang.Object

The Aggregation class performs the actual aggregation operations. It contains a Builder class that, following the Builder Pattern, builds a Aggregation object that can be used for the actual aggregation calculations.

Since:
0.7.0
Author:
Randy Gettman

Nested Class Summary
static class Aggregation.Builder
          This Builder class follows the "Builder" pattern to create an Aggregation object.
 
Method Summary
<T> java.util.List<AggregateValue<T>>
groupBy(java.util.List<T> values)
          Perform one or more aggregate operations on a List<T>.
<T extends java.lang.Comparable<? super T>>
java.util.List<AggregateValue<T>>
groupByComparable(java.util.List<T> values)
          Perform one or more aggregate operations on a List<T>.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

groupByComparable

public <T extends java.lang.Comparable<? super T>> java.util.List<AggregateValue<T>> groupByComparable(java.util.List<T> values)
Perform one or more aggregate operations on a List<T>. T should have a "natural ordering", that is, it must be Comparable, and compareTo defines the properties with which to "group by" with its consideration of different properties to determine order. This sorts a copy of the list of values, based how the objects' compareTo method compares them.

Type Parameters:
T - The object type to aggregate, which must be Comparable.
Parameters:
values - The List<T> of objects to aggregate.
Returns:
A List<AggregateValue<T>>.

groupBy

public <T> java.util.List<AggregateValue<T>> groupBy(java.util.List<T> values)
Perform one or more aggregate operations on a List<T>. T does not need to be Comparable. This operates on a copy of the list of values, either sorted based on the "group by" properties (if any), or grouped into equivalence classes using multiset discrimination.

Type Parameters:
T - The object type to aggregate.
Parameters:
values - The List<T> of objects to aggregate.
Returns:
A List<AggregateValue<T>>.


Copyright © 2010-2013 jAgg Team. All Rights Reserved.