Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DoubleSumAggregationOperator.cs
Go to the documentation of this file.
1
using
System.Collections.Generic
;
2
using
System.Threading
;
3
4
namespace
System.Linq.Parallel
;
5
6
internal
sealed
class
DoubleSumAggregationOperator
:
InlinedAggregationOperator
<double, double, double>
7
{
8
private
sealed
class
DoubleSumAggregationOperatorEnumerator
<TKey> :
InlinedAggregationOperatorEnumerator
<double>
9
{
10
private
readonly
QueryOperatorEnumerator<double, TKey>
_source
;
11
12
internal
DoubleSumAggregationOperatorEnumerator
(
QueryOperatorEnumerator<double, TKey>
source
,
int
partitionIndex
,
CancellationToken
cancellationToken
)
13
:
base
(
partitionIndex
,
cancellationToken
)
14
{
15
_source
=
source
;
16
}
17
18
protected
override
bool
MoveNextCore
(
ref
double
currentElement
)
19
{
20
double
currentElement2
= 0.0;
21
TKey currentKey =
default
(TKey);
22
QueryOperatorEnumerator<double, TKey>
source
=
_source
;
23
if
(
source
.MoveNext(
ref
currentElement2
,
ref
currentKey))
24
{
25
double
num = 0.0;
26
int
num2
= 0;
27
do
28
{
29
if
((
num2
++ & 0
x3F
) == 0)
30
{
31
_cancellationToken
.
ThrowIfCancellationRequested
();
32
}
33
num +=
currentElement2
;
34
}
35
while
(
source
.MoveNext(
ref
currentElement2
,
ref
currentKey));
36
currentElement
= num;
37
return
true
;
38
}
39
return
false
;
40
}
41
42
protected
override
void
Dispose
(
bool
disposing
)
43
{
44
_source
.
Dispose
();
45
}
46
}
47
48
internal
DoubleSumAggregationOperator
(
IEnumerable<double>
child)
49
:
base
(child)
50
{
51
}
52
53
protected
override
double
InternalAggregate
(
ref
Exception
singularExceptionToThrow
)
54
{
55
using
IEnumerator
<
double
>
enumerator
= GetEnumerator(
ParallelMergeOptions
.FullyBuffered,
suppressOrderPreservation
:
true
);
56
double
num = 0.0;
57
while
(
enumerator
.MoveNext())
58
{
59
num +=
enumerator
.Current;
60
}
61
return
num;
62
}
63
64
protected
override
QueryOperatorEnumerator<double, int>
CreateEnumerator<TKey>
(
int
index
,
int
count
,
QueryOperatorEnumerator<double, TKey>
source
,
object
sharedData
,
CancellationToken
cancellationToken
)
65
{
66
return
new
DoubleSumAggregationOperatorEnumerator<TKey>
(
source
,
index
,
cancellationToken
);
67
}
68
}
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Exception
Definition
Exception.cs:15
System.Linq.Parallel.DoubleSumAggregationOperator.DoubleSumAggregationOperatorEnumerator.MoveNextCore
override bool MoveNextCore(ref double currentElement)
Definition
DoubleSumAggregationOperator.cs:18
System.Linq.Parallel.DoubleSumAggregationOperator.DoubleSumAggregationOperatorEnumerator._source
readonly QueryOperatorEnumerator< double, TKey > _source
Definition
DoubleSumAggregationOperator.cs:10
System.Linq.Parallel.DoubleSumAggregationOperator.DoubleSumAggregationOperatorEnumerator.DoubleSumAggregationOperatorEnumerator
DoubleSumAggregationOperatorEnumerator(QueryOperatorEnumerator< double, TKey > source, int partitionIndex, CancellationToken cancellationToken)
Definition
DoubleSumAggregationOperator.cs:12
System.Linq.Parallel.DoubleSumAggregationOperator.DoubleSumAggregationOperatorEnumerator.Dispose
override void Dispose(bool disposing)
Definition
DoubleSumAggregationOperator.cs:42
System.Linq.Parallel.DoubleSumAggregationOperator.DoubleSumAggregationOperatorEnumerator
Definition
DoubleSumAggregationOperator.cs:9
System.Linq.Parallel.DoubleSumAggregationOperator.CreateEnumerator< TKey >
override QueryOperatorEnumerator< double, int > CreateEnumerator< TKey >(int index, int count, QueryOperatorEnumerator< double, TKey > source, object sharedData, CancellationToken cancellationToken)
Definition
DoubleSumAggregationOperator.cs:64
System.Linq.Parallel.DoubleSumAggregationOperator.DoubleSumAggregationOperator
DoubleSumAggregationOperator(IEnumerable< double > child)
Definition
DoubleSumAggregationOperator.cs:48
System.Linq.Parallel.DoubleSumAggregationOperator.InternalAggregate
override double InternalAggregate(ref Exception singularExceptionToThrow)
Definition
DoubleSumAggregationOperator.cs:53
System.Linq.Parallel.DoubleSumAggregationOperator
Definition
DoubleSumAggregationOperator.cs:7
System.Linq.Parallel.InlinedAggregationOperatorEnumerator< double >::_cancellationToken
CancellationToken _cancellationToken
Definition
InlinedAggregationOperatorEnumerator.cs:12
System.Linq.Parallel.InlinedAggregationOperatorEnumerator
Definition
InlinedAggregationOperatorEnumerator.cs:7
System.Linq.Parallel.InlinedAggregationOperator
Definition
InlinedAggregationOperator.cs:8
System.Linq.Parallel.QueryOperatorEnumerator.Dispose
void Dispose()
Definition
QueryOperatorEnumerator.cs:44
System.Collections.Generic.IEnumerator
Definition
IEnumerator.cs:4
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Linq.Parallel
Definition
AnyAllSearchOperator.cs:5
System.Linq.ExceptionArgument.source
@ source
System.Linq.ExceptionArgument.index
@ index
System.Linq.ExceptionArgument.count
@ count
System.Linq.ParallelMergeOptions
ParallelMergeOptions
Definition
ParallelMergeOptions.cs:4
System.Threading
Definition
TaskToApm.cs:3
System.ExceptionArgument.cancellationToken
@ cancellationToken
System.Threading.CancellationToken.ThrowIfCancellationRequested
void ThrowIfCancellationRequested()
Definition
CancellationToken.cs:115
System.Threading.CancellationToken
Definition
CancellationToken.cs:8
source
System.Linq.Parallel
System.Linq.Parallel
DoubleSumAggregationOperator.cs
Generated by
1.10.0