Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NullableFloatAverageAggregationOperator.cs
Go to the documentation of this file.
3
5
6internal sealed class NullableFloatAverageAggregationOperator : InlinedAggregationOperator<float?, Pair<double, long>, float?>
7{
9 {
11
17
19 {
20 double num = 0.0;
21 long num2 = 0L;
23 float? currentElement2 = null;
24 TKey currentKey = default(TKey);
25 int num3 = 0;
26 while (source.MoveNext(ref currentElement2, ref currentKey))
27 {
28 if ((num3++ & 0x3F) == 0)
29 {
31 }
32 if (currentElement2.HasValue)
33 {
34 num += (double)currentElement2.GetValueOrDefault();
35 num2 = checked(num2 + 1);
36 }
37 }
39 return num2 > 0;
40 }
41
42 protected override void Dispose(bool disposing)
43 {
45 }
46 }
47
52
54 {
56 {
58 if (!enumerator.MoveNext())
59 {
60 return null;
61 }
62 Pair<double, long> current = enumerator.Current;
63 while (enumerator.MoveNext())
64 {
65 current.First += enumerator.Current.First;
66 current.Second += enumerator.Current.Second;
67 }
68 return (float)(current.First / (double)current.Second);
69 }
70 }
71
76}
NullableFloatAverageAggregationOperatorEnumerator(QueryOperatorEnumerator< float?, TKey > source, int partitionIndex, CancellationToken cancellationToken)
override QueryOperatorEnumerator< Pair< double, long >, int > CreateEnumerator< TKey >(int index, int count, QueryOperatorEnumerator< float?, TKey > source, object sharedData, CancellationToken cancellationToken)
override? float InternalAggregate(ref Exception singularExceptionToThrow)