Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Aggregate()

override object System.Data.Common.StringStorage.Aggregate ( int[] recordNos,
AggregateType kind )
inlinevirtual

Reimplemented from System.Data.Common.DataStorage.

Definition at line 15 of file StringStorage.cs.

16 {
17 switch (kind)
18 {
19 case AggregateType.Min:
20 {
21 int num3 = -1;
22 int i;
23 for (i = 0; i < recordNos.Length; i++)
24 {
25 if (!IsNull(recordNos[i]))
26 {
27 num3 = recordNos[i];
28 break;
29 }
30 }
31 if (num3 >= 0)
32 {
33 for (i++; i < recordNos.Length; i++)
34 {
35 if (!IsNull(recordNos[i]) && Compare(num3, recordNos[i]) > 0)
36 {
37 num3 = recordNos[i];
38 }
39 }
40 return Get(num3);
41 }
42 return _nullValue;
43 }
44 case AggregateType.Max:
45 {
46 int num2 = -1;
47 int i;
48 for (i = 0; i < recordNos.Length; i++)
49 {
50 if (!IsNull(recordNos[i]))
51 {
52 num2 = recordNos[i];
53 break;
54 }
55 }
56 if (num2 >= 0)
57 {
58 for (i++; i < recordNos.Length; i++)
59 {
60 if (Compare(num2, recordNos[i]) < 0)
61 {
62 num2 = recordNos[i];
63 }
64 }
65 return Get(num2);
66 }
67 return _nullValue;
68 }
69 case AggregateType.Count:
70 {
71 int num = 0;
72 for (int i = 0; i < recordNos.Length; i++)
73 {
74 object obj = _values[recordNos[i]];
75 if (obj != null)
76 {
77 num++;
78 }
79 }
80 return num;
81 }
82 default:
83 throw ExceptionBuilder.AggregateException(kind, _dataType);
84 }
85 }
override int Compare(int recordNo1, int recordNo2)
override object Get(int recordNo)

References System.Data.Common.DataStorage._dataType, System.Data.Common.DataStorage._nullValue, System.Data.Common.StringStorage._values, System.Data.ExceptionBuilder.AggregateException(), System.Data.Common.StringStorage.Compare(), System.Data.Common.StringStorage.Get(), System.Data.IsNull, and System.obj.