public override object Aggregate(int[] recordNos, AggregateType kind)
{
int i;
switch (kind)
{
case AggregateType.Min:
int min = -1;
for (i = 0; i < recordNos.Length; i++)
{
if (IsNull(recordNos[i]))
continue;
min = recordNos[i];
break;
}
if (min >= 0)
{
for (i = i + 1; i < recordNos.Length; i++)
{
if (IsNull(recordNos[i]))
continue;
if (Compare(min, recordNos[i]) > 0)
{
min = recordNos[i];
}
}
return Get(min);
}
return _nullValue;
case AggregateType.Max:
int max = -1;
for (i = 0; i < recordNos.Length; i++)
{
if (IsNull(recordNos[i]))
continue;
max = recordNos[i];
break;
}
if (max >= 0)
{
for (i = i + 1; i < recordNos.Length; i++)
{
if (Compare(max, recordNos[i]) < 0)
{
max = recordNos[i];
}
}
return Get(max);
}
return _nullValue;
case AggregateType.Count:
int count = 0;
for (i = 0; i < recordNos.Length; i++)
{
object value = _values[recordNos[i]];
if (value != null)
count++;
}
return count;
}
throw ExceptionBuilder.AggregateException(kind, _dataType);
}