Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NullableLongAverageAggregationOperator.cs
Go to the documentation of this file.
3
5
6internal sealed class NullableLongAverageAggregationOperator : InlinedAggregationOperator<long?, Pair<long, long>, double?>
7{
9 {
11
17
19 {
20 long num = 0L;
21 long num2 = 0L;
23 long? 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 }
33 {
34 if (currentElement2.HasValue)
35 {
36 num += currentElement2.GetValueOrDefault();
37 num2++;
38 }
39 }
40 }
42 return num2 > 0;
43 }
44
45 protected override void Dispose(bool disposing)
46 {
48 }
49 }
50
52 : base(child)
53 {
54 }
55
57 {
59 {
61 if (!enumerator.MoveNext())
62 {
63 return null;
64 }
65 Pair<long, long> current = enumerator.Current;
66 while (enumerator.MoveNext())
67 {
68 current.First += enumerator.Current.First;
69 current.Second += enumerator.Current.Second;
70 }
71 return (double)current.First / (double)current.Second;
72 }
73 }
74
79}
NullableLongAverageAggregationOperatorEnumerator(QueryOperatorEnumerator< long?, TKey > source, int partitionIndex, CancellationToken cancellationToken)
override QueryOperatorEnumerator< Pair< long, long >, int > CreateEnumerator< TKey >(int index, int count, QueryOperatorEnumerator< long?, TKey > source, object sharedData, CancellationToken cancellationToken)
override? double InternalAggregate(ref Exception singularExceptionToThrow)