package mil.nga.giat.geowave.core.store.query.aggregate;

import mil.nga.giat.geowave.core.index.Persistable;

public class CountAggregation<T> implements
		Aggregation<Persistable, CountResult, T>
{
	private CountResult countResult = new CountResult();

	public CountAggregation() {}

	@Override
	public String toString() {
		return countResult.toString();
	}

	@Override
	public void aggregate(
			final T entry ) {
		if (!countResult.isSet()) {
			countResult.count = 0;
		}
		countResult.count += 1;
	}

	@Override
	public Persistable getParameters() {
		return null;
	}

	@Override
	public CountResult getResult() {
		if (!countResult.isSet()) {
			return null;
		}
		return countResult;
	}

	@Override
	public void setParameters(
			final Persistable parameters ) {}

	@Override
	public void clearResult() {
		countResult.count = 0;
	}
}

@@ -206,144 +206,317 @@
 ate 
-CountResult countResult = new CountResult();%0A%0A%09public CountAggregation() %7B%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09return countResult
+long count = Long.MIN_VALUE;%0A%0A%09public CountAggregation() %7B%7D%0A%09%0A%09public boolean isSet() %7B%0A%09%09return count != Long.MIN_VALUE;%0A%09%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09final StringBuffer buffer = new StringBuffer();%0A%09%09buffer.append(%0A%09%09%09%09%22count%5Bcount=%22).append(%0A%09%09%09%09count);%0A%09%09buffer.append(%22%5D%22);%0A%09%09return buffer
 .toS
@@ -587,36 +587,24 @@
  ) %7B%0A%09%09if (!
-countResult.
 isSet()) %7B%0A%09
@@ -614,44 +614,23 @@
 ount
-Result.count = 0;%0A%09%09%7D%0A%09%09countResult.
+ = 0;%0A%09%09%7D%0A%09%09%0A%09%09
 coun
@@ -761,28 +761,16 @@
 %0A%09%09if (!
-countResult.
 isSet())
@@ -792,16 +792,19 @@
 ll;%0A%09%09%7D%0A
+%09%09%0A
 %09%09return
@@ -800,25 +800,29 @@
 %09%09%0A%09%09return 
-c
+new C
 ountResult;%0A
@@ -819,16 +819,23 @@
 ntResult
+(count)
 ;%0A%09%7D%0A%0A%09@
@@ -955,20 +955,8 @@
 %7B%0A%09%09
-countResult.
 coun

Return new CountResult on getResult, and use long instead of CountResult object internally