Removed getter and setter from AggregateState

git-svn-id: https://hyracks.googlecode.com/svn/branches/aggregators_dev_next@972 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/AggregateState.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/AggregateState.java
index 9bb54db..79a62d1 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/AggregateState.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/AggregateState.java
@@ -23,7 +23,7 @@
     
     private static final long serialVersionUID = 1L;
     
-    Object state = null;
+    public Object state = null;
     
     public AggregateState(){
         state = null;
@@ -33,11 +33,6 @@
         state = obj;
     }
 
-    public void setState(Object obj) {
-        state = null;
-        state = obj;
-    }
-
     public void reset() {
         state = null;
     }
@@ -45,9 +40,5 @@
     public void close() {
         state = null;
     }
-
-    public Object getState() {
-        return state;
-    }
     
 }
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/AvgFieldGroupAggregatorFactory.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/AvgFieldGroupAggregatorFactory.java
index f68f683..c140a49 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/AvgFieldGroupAggregatorFactory.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/AvgFieldGroupAggregatorFactory.java
@@ -65,7 +65,7 @@
                     sum = IntegerSerializerDeserializer.getInt(data, offset);
                     count = IntegerSerializerDeserializer.getInt(data, offset + 4);
                 } else {
-                    Integer[] fields = (Integer[])state.getState();
+                    Integer[] fields = (Integer[])state.state;
                     sum = fields[0];
                     count = fields[1];
                 }
@@ -86,7 +86,7 @@
                     sum = IntegerSerializerDeserializer.getInt(data, offset);
                     count = IntegerSerializerDeserializer.getInt(data, offset + 4);
                 } else {
-                    Integer[] fields = (Integer[])state.getState();
+                    Integer[] fields = (Integer[])state.state;
                     sum = fields[0];
                     count = fields[1];
                 }
@@ -120,7 +120,7 @@
                                 "I/O exception when initializing the aggregator.");
                     }
                 } else {
-                    state.setState(new Integer[]{sum, count});
+                    state.state = new Integer[]{sum, count};
                 }
             }
             
@@ -149,10 +149,10 @@
                     buf.putInt(offset, sum);
                     buf.putInt(offset + 4, count);
                 } else {
-                    Integer[] fields = (Integer[])state.getState();
+                    Integer[] fields = (Integer[])state.state;
                     sum += fields[0];
                     count += fields[1];
-                    state.setState(new Integer[]{sum, count});
+                    state.state = new Integer[]{sum, count};
                 }
             }
 
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/AvgFieldMergeAggregatorFactory.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/AvgFieldMergeAggregatorFactory.java
index f463119..c6d4e99 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/AvgFieldMergeAggregatorFactory.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/AvgFieldMergeAggregatorFactory.java
@@ -66,7 +66,7 @@
                     sum = IntegerSerializerDeserializer.getInt(data, offset);
                     count = IntegerSerializerDeserializer.getInt(data, offset + 4);
                 } else {
-                    Integer[] fields = (Integer[])state.getState();
+                    Integer[] fields = (Integer[])state.state;
                     sum = fields[0];
                     count = fields[1];
                 }
@@ -87,7 +87,7 @@
                     sum = IntegerSerializerDeserializer.getInt(data, offset);
                     count = IntegerSerializerDeserializer.getInt(data, offset + 4);
                 } else {
-                    Integer[] fields = (Integer[])state.getState();
+                    Integer[] fields = (Integer[])state.state;
                     sum = fields[0];
                     count = fields[1];
                 }
@@ -124,10 +124,10 @@
                     buf.putInt(offset, sum);
                     buf.putInt(offset + 4, count);
                 } else {
-                    Integer[] fields = (Integer[])state.getState();
+                    Integer[] fields = (Integer[])state.state;
                     sum += fields[0];
                     count += fields[1];
-                    state.setState(new Integer[]{sum, count});
+                    state.state = new Integer[]{sum, count};
                 }
             }
 
@@ -194,7 +194,7 @@
                                 "I/O exception when initializing the aggregator.");
                     }
                 } else {
-                    state.setState(new Integer[]{sum, count});
+                    state.state = new Integer[]{sum, count};
                 }
             }
         };
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/CountFieldAggregatorFactory.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/CountFieldAggregatorFactory.java
index a4214a7..e36a168 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/CountFieldAggregatorFactory.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/CountFieldAggregatorFactory.java
@@ -68,7 +68,7 @@
                 if (!useObjectState) {
                     count = IntegerSerializerDeserializer.getInt(data, offset);
                 } else {
-                    count = (Integer) state.getState();
+                    count = (Integer) state.state;
                 }
                 try {
                     fieldOutput.writeInt(count);
@@ -86,7 +86,7 @@
                 if (!useObjectState) {
                     count = IntegerSerializerDeserializer.getInt(data, offset);
                 } else {
-                    count = (Integer) state.getState();
+                    count = (Integer) state.state;
                 }
                 try {
                     fieldOutput.writeInt(count);
@@ -109,7 +109,7 @@
                                 "I/O exception when initializing the aggregator.");
                     }
                 } else {
-                    state.setState(count);
+                    state.state = count;
                 }
             }
 
@@ -140,8 +140,8 @@
                     count += buf.getInt(offset);
                     buf.putInt(offset, count);
                 } else {
-                    count += (Integer) state.getState();
-                    state.setState(count);
+                    count += (Integer) state.state;
+                    state.state = count;
                 }
             }
 
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/IntSumFieldAggregatorFactory.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/IntSumFieldAggregatorFactory.java
index 43de9c6..270ada0 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/IntSumFieldAggregatorFactory.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/IntSumFieldAggregatorFactory.java
@@ -72,7 +72,7 @@
                 if (!useObjectState) {
                     sum = IntegerSerializerDeserializer.getInt(data, offset);
                 } else {
-                    sum = (Integer) state.getState();
+                    sum = (Integer) state.state;
                 }
                 try {
                     fieldOutput.writeInt(sum);
@@ -90,7 +90,7 @@
                 if (!useObjectState) {
                     sum = IntegerSerializerDeserializer.getInt(data, offset);
                 } else {
-                    sum = (Integer) state.getState();
+                    sum = (Integer) state.state;
                 }
                 try {
                     fieldOutput.writeInt(sum);
@@ -122,7 +122,7 @@
                                 "I/O exception when initializing the aggregator.");
                     }
                 } else {
-                    state.setState(sum);
+                    state.state = sum;
                 }
             }
 
@@ -160,8 +160,8 @@
                     sum += buf.getInt(offset);
                     buf.putInt(offset, sum);
                 } else {
-                    sum += (Integer) state.getState();
-                    state.setState(sum);
+                    sum += (Integer) state.state;
+                    state.state = sum;
                 }
             }
 
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/MinMaxStringFieldAggregatorFactory.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/MinMaxStringFieldAggregatorFactory.java
index 35aa967..b8656da 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/MinMaxStringFieldAggregatorFactory.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/MinMaxStringFieldAggregatorFactory.java
@@ -78,10 +78,10 @@
                     if (hasBinaryState) {
                         int stateIdx = IntegerSerializerDeserializer.getInt(
                                 data, offset);
-                        Object[] storedState = (Object[]) state.getState();
+                        Object[] storedState = (Object[]) state.state;
                         fieldOutput.writeUTF((String) storedState[stateIdx]);
                     } else {
-                        fieldOutput.writeUTF((String) state.getState());
+                        fieldOutput.writeUTF((String) state.state);
                     }
                 } catch (IOException e) {
                     throw new HyracksDataException(
@@ -97,10 +97,10 @@
                     if (hasBinaryState) {
                         int stateIdx = IntegerSerializerDeserializer.getInt(
                                 data, offset);
-                        Object[] storedState = (Object[]) state.getState();
+                        Object[] storedState = (Object[]) state.state;
                         fieldOutput.writeUTF((String) storedState[stateIdx]);
                     } else {
-                        fieldOutput.writeUTF((String) state.getState());
+                        fieldOutput.writeUTF((String) state.state);
                     }
                 } catch (IOException e) {
                     throw new HyracksDataException(
@@ -124,18 +124,18 @@
                 if (hasBinaryState) {
                     // Object-binary-state
                     Object[] storedState;
-                    if (state.getState() == null) {
+                    if (state.state == null) {
                         storedState = new Object[8];
                         storedState[0] = new Integer(0);
-                        state.setState(storedState);
+                        state.state = storedState;
                     } else {
-                        storedState = (Object[]) state.getState();
+                        storedState = (Object[]) state.state;
                     }
                     int stateCount = (Integer) (storedState[0]);
                     if (stateCount + 1 >= storedState.length) {
                         storedState = Arrays.copyOf(storedState,
                                 storedState.length * 2);
-                        state.setState(storedState);
+                        state.state = storedState;
                     }
 
                     stateCount++;
@@ -148,7 +148,7 @@
                     }
                 } else {
                     // Only object-state
-                    state.setState(strField);
+                    state.state = strField;
                 }
             }
 
@@ -175,7 +175,7 @@
                     int stateIdx = IntegerSerializerDeserializer.getInt(data,
                             offset);
 
-                    Object[] storedState = (Object[]) state.getState();
+                    Object[] storedState = (Object[]) state.state;
 
                     if (isMax) {
                         if (strField.length() > ((String) (storedState[stateIdx]))
@@ -190,14 +190,14 @@
                     }
                 } else {
                     if (isMax) {
-                        if (strField.length() > ((String) (state.getState()))
+                        if (strField.length() > ((String) (state.state))
                                 .length()) {
-                            state.setState(strField);
+                            state.state = strField;
                         }
                     } else {
-                        if (strField.length() < ((String) (state.getState()))
+                        if (strField.length() < ((String) (state.state))
                                 .length()) {
-                            state.setState(strField);
+                            state.state = strField;
                         }
                     }
                 }
@@ -236,11 +236,11 @@
                     int stateIdx = IntegerSerializerDeserializer.getInt(data,
                             offset);
 
-                    Object[] storedState = (Object[]) state.getState();
+                    Object[] storedState = (Object[]) state.state;
 
                     len = getUTFLength(((String) (storedState[stateIdx])));
                 } else {
-                    len = getUTFLength((String) (state.getState()));
+                    len = getUTFLength((String) (state.state));
                 }
 
                 return len;
@@ -255,11 +255,11 @@
                     int stateIdx = IntegerSerializerDeserializer.getInt(data,
                             offset);
 
-                    Object[] storedState = (Object[]) state.getState();
+                    Object[] storedState = (Object[]) state.state;
 
                     len = getUTFLength(((String) (storedState[stateIdx])));
                 } else {
-                    len = getUTFLength((String) (state.getState()));
+                    len = getUTFLength((String) (state.state));
                 }
 
                 return len;
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/MultiFieldsAggregatorFactory.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/MultiFieldsAggregatorFactory.java
index 27ad066..c1d67fe 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/MultiFieldsAggregatorFactory.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/aggregators/MultiFieldsAggregatorFactory.java
@@ -116,7 +116,7 @@
                             .getBuffer().array(),
                             fieldOffset + accessor.getFieldSlotsLength()
                                     + tupleOffset, ((AggregateState[]) state
-                                    .getState())[i]);
+                                    .state)[i]);
                     resultTupleBuilder.addFieldEndOffset();
                 }
 
@@ -150,10 +150,10 @@
                                 .getBuffer().array(),
                                 tupleOffset + accessor.getFieldSlotsLength()
                                         + fieldOffset,
-                                ((AggregateState[]) state.getState())[i]);
+                                ((AggregateState[]) state.state)[i]);
                     } else {
                         aggregators[i].outputFinalResult(dos, null, 0,
-                                ((AggregateState[]) state.getState())[i]);
+                                ((AggregateState[]) state.state)[i]);
                     }
                     resultTupleBuilder.addFieldEndOffset();
                 }
@@ -188,7 +188,7 @@
                             accessor.getBuffer().array(), tupleOffset
                                     + accessor.getFieldSlotsLength()
                                     + fieldOffset,
-                            ((AggregateState[]) state.getState())[i]);
+                            ((AggregateState[]) state.state)[i]);
                     // add length for slot offset
                     stateLength += 4;
                 }
@@ -219,7 +219,7 @@
                             .getBuffer().array(),
                             tupleOffset + accessor.getFieldSlotsLength()
                                     + fieldOffset, ((AggregateState[]) state
-                                    .getState())[i]);
+                                    .state)[i]);
                     // add length for slot offset
                     stateLength += 4;
                 }
@@ -239,7 +239,7 @@
 
                 for (int i = 0; i < aggregators.length; i++) {
                     aggregators[i].init(accessor, tIndex, dos,
-                            ((AggregateState[]) state.getState())[i]);
+                            ((AggregateState[]) state.state)[i]);
                     if (aggregators[i].needsBinaryState()) {
                         stateTupleBuilder.addFieldEndOffset();
                     }
@@ -276,7 +276,7 @@
                     if (aggregators[i].needsBinaryState()) {
                         stateLength += aggregators[i].getBinaryStateLength(
                                 accessor, tIndex,
-                                ((AggregateState[]) state.getState())[i]);
+                                ((AggregateState[]) state.state)[i]);
                         // add length for slot offset
                         stateLength += 4;
                     }
@@ -312,17 +312,17 @@
                                             + stateAccessor
                                                     .getFieldSlotsLength()
                                             + stateFieldOffset,
-                                    ((AggregateState[]) state.getState())[i]);
+                                    ((AggregateState[]) state.state)[i]);
                             fieldIndex++;
                         } else {
                             aggregators[i].aggregate(accessor, tIndex, null, 0,
-                                    ((AggregateState[]) state.getState())[i]);
+                                    ((AggregateState[]) state.state)[i]);
                         }
                     }
                 } else {
                     for (int i = 0; i < aggregators.length; i++) {
                         aggregators[i].aggregate(accessor, tIndex, null, 0,
-                                ((AggregateState[]) state.getState())[i]);
+                                ((AggregateState[]) state.state)[i]);
                     }
                 }
             }