1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.sql.ResultDescription; 25 import org.apache.derby.iapi.services.io.StoredFormatIds; 26 import org.apache.derby.iapi.services.io.FormatIdUtil; 27 import org.apache.derby.iapi.services.io.Formatable; 28 import org.apache.derby.iapi.services.sanity.SanityManager; 29 30 import java.io.ObjectOutput ; 31 import java.io.ObjectInput ; 32 import java.io.IOException ; 33 42 public class AggregatorInfo implements Formatable 43 { 44 60 61 64 String aggregateName; 65 int inputColumn; 66 int outputColumn; 67 int aggregatorColumn; 68 String aggregatorClassName; 69 boolean isDistinct; 70 ResultDescription rd; 71 72 75 public AggregatorInfo() {} 76 77 95 public AggregatorInfo 96 ( 97 String aggregateName, 98 String aggregatorClassName, 99 int inputColNum, 100 int outputColNum, 101 int aggregatorColNum, 102 boolean isDistinct, 103 ResultDescription rd 104 ) 105 { 106 this.aggregateName = aggregateName; 107 this.aggregatorClassName = aggregatorClassName; 108 this.inputColumn = inputColNum; 109 this.outputColumn = outputColNum; 110 this.aggregatorColumn = aggregatorColNum; 111 this.isDistinct = isDistinct; 112 this.rd = rd; 113 } 114 115 120 public String getAggregateName() 121 { 122 return aggregateName; 123 } 124 125 131 public String getAggregatorClassName() 132 { 133 return aggregatorClassName; 134 } 135 136 137 143 public int getAggregatorColNum() 144 { 145 return aggregatorColumn; 146 } 147 148 154 public int getInputColNum() 155 { 156 return inputColumn; 157 } 158 159 165 public int getOutputColNum() 166 { 167 return outputColumn; 168 } 169 170 175 public boolean isDistinct() 176 { 177 return isDistinct; 178 } 179 180 186 public ResultDescription getResultDescription() 187 { 188 return rd; 189 } 190 191 196 public String toString() 197 { 198 if (SanityManager.DEBUG) 199 { 200 return "AggregatorInfo = Name: "+ aggregateName + 201 "\n\tClass: " + aggregatorClassName + 202 "\n\tInputColNum: " + inputColumn + 203 "\n\tOutputColNum: " + outputColumn + 204 "\n\tAggregatorColNum: " + aggregatorColumn + 205 "\n\tDistinct: " + isDistinct + 206 "\n" + rd; 207 } 208 else 209 { 210 return ""; 211 } 212 } 213 214 215 227 public void writeExternal(ObjectOutput out) throws IOException 228 { 229 out.writeObject(aggregateName); 230 out.writeInt(inputColumn); 231 out.writeInt(outputColumn); 232 out.writeInt(aggregatorColumn); 233 out.writeObject(aggregatorClassName); 234 out.writeBoolean(isDistinct); 235 out.writeObject(rd); 236 } 237 238 246 public void readExternal(ObjectInput in) 247 throws IOException , ClassNotFoundException 248 { 249 aggregateName = (String )in.readObject(); 250 inputColumn = in.readInt(); 251 outputColumn = in.readInt(); 252 aggregatorColumn = in.readInt(); 253 aggregatorClassName = (String )in.readObject(); 254 isDistinct = in.readBoolean(); 255 rd = (ResultDescription)in.readObject(); 256 } 257 258 263 public int getTypeFormatId() { return StoredFormatIds.AGG_INFO_V01_ID; } 264 } 265 | Popular Tags |