1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 import org.apache.derby.iapi.sql.execute.ExecAggregator; 26 import org.apache.derby.iapi.types.DataValueDescriptor; 27 import org.apache.derby.iapi.error.StandardException; 28 import org.apache.derby.iapi.services.io.Formatable; 29 30 31 import java.io.ObjectOutput ; 32 import java.io.ObjectInput ; 33 import java.io.IOException ; 34 35 40 abstract class OrderableAggregator extends SystemAggregator 41 { 42 protected DataValueDescriptor value; 43 44 46 public void setup(String aggregateName) 47 { 48 } 49 50 55 public void merge(ExecAggregator addend) 56 throws StandardException 57 { 58 if (SanityManager.DEBUG) 59 { 60 SanityManager.ASSERT(addend instanceof OrderableAggregator, 61 "addend is supposed to be the same type of aggregator for the merge operator"); 62 } 63 64 DataValueDescriptor bv = ((OrderableAggregator)addend).value; 66 if (bv != null) 67 this.accumulate(bv); 68 } 69 70 76 public DataValueDescriptor getResult() throws StandardException 77 { 78 return value; 79 } 80 81 103 public void writeExternal(ObjectOutput out) throws IOException 104 { 105 super.writeExternal(out); 106 out.writeObject(value); 107 } 108 109 115 public void readExternal(ObjectInput in) 116 throws IOException , ClassNotFoundException 117 { 118 super.readExternal(in); 119 value = (DataValueDescriptor) in.readObject(); 120 } 121 } 122 | Popular Tags |