Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NullableIntSumAggregationOperator.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
NullableIntSumAggregationOperator
:
InlinedAggregationOperator
<int?, int?, int?>
7
{
8
private
sealed
class
NullableIntSumAggregationOperatorEnumerator
<TKey> :
InlinedAggregationOperatorEnumerator
<int?>
9
{
10
private
readonly
QueryOperatorEnumerator<int?, TKey>
_source
;
11
12
internal
NullableIntSumAggregationOperatorEnumerator
(
QueryOperatorEnumerator<int?, TKey>
source
,
int
partitionIndex
,
CancellationToken
cancellationToken
)
13
:
base
(
partitionIndex
,
cancellationToken
)
14
{
15
_source
=
source
;
16
}
17
18
protected
override
bool
MoveNextCore
(
ref
int
?
currentElement
)
19
{
20
int
?
currentElement2
=
null
;
21
TKey currentKey =
default
(TKey);
22
QueryOperatorEnumerator<int?, TKey>
source
=
_source
;
23
if
(
source
.MoveNext(
ref
currentElement2
,
ref
currentKey))
24
{
25
int
num = 0;
26
int
num2
= 0;
27
do
28
{
29
if
((
num2
++ & 0
x3F
) == 0)
30
{
31
_cancellationToken
.
ThrowIfCancellationRequested
();
32
}
33
num =
checked
(num +
currentElement2
.GetValueOrDefault());
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
NullableIntSumAggregationOperator
(
IEnumerable<int?>
child)
49
:
base
(child)
50
{
51
}
52
53
protected
override
int
?
InternalAggregate
(
ref
Exception
singularExceptionToThrow
)
54
{
55
using
IEnumerator
<
int
?>
enumerator
= GetEnumerator(
ParallelMergeOptions
.FullyBuffered,
suppressOrderPreservation
:
true
);
56
int
num = 0;
57
while
(
enumerator
.MoveNext())
58
{
59
num =
checked
(num +
enumerator
.Current.GetValueOrDefault());
60
}
61
return
num;
62
}
63
64
protected
override
QueryOperatorEnumerator<int?, int>
CreateEnumerator<TKey>
(
int
index
,
int
count
,
QueryOperatorEnumerator<int?, TKey>
source
,
object
sharedData
,
CancellationToken
cancellationToken
)
65
{
66
return
new
NullableIntSumAggregationOperatorEnumerator<TKey>
(
source
,
index
,
cancellationToken
);
67
}
68
}
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Exception
Definition
Exception.cs:15
System.Linq.Parallel.InlinedAggregationOperatorEnumerator< int?>::_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.NullableIntSumAggregationOperator.NullableIntSumAggregationOperatorEnumerator.NullableIntSumAggregationOperatorEnumerator
NullableIntSumAggregationOperatorEnumerator(QueryOperatorEnumerator< int?, TKey > source, int partitionIndex, CancellationToken cancellationToken)
Definition
NullableIntSumAggregationOperator.cs:12
System.Linq.Parallel.NullableIntSumAggregationOperator.NullableIntSumAggregationOperatorEnumerator.Dispose
override void Dispose(bool disposing)
Definition
NullableIntSumAggregationOperator.cs:42
System.Linq.Parallel.NullableIntSumAggregationOperator.NullableIntSumAggregationOperatorEnumerator._source
readonly QueryOperatorEnumerator< int?, TKey > _source
Definition
NullableIntSumAggregationOperator.cs:10
System.Linq.Parallel.NullableIntSumAggregationOperator.NullableIntSumAggregationOperatorEnumerator.MoveNextCore
override bool MoveNextCore(ref int? currentElement)
Definition
NullableIntSumAggregationOperator.cs:18
System.Linq.Parallel.NullableIntSumAggregationOperator.NullableIntSumAggregationOperatorEnumerator
Definition
NullableIntSumAggregationOperator.cs:9
System.Linq.Parallel.NullableIntSumAggregationOperator.CreateEnumerator< TKey >
override QueryOperatorEnumerator< int?, int > CreateEnumerator< TKey >(int index, int count, QueryOperatorEnumerator< int?, TKey > source, object sharedData, CancellationToken cancellationToken)
Definition
NullableIntSumAggregationOperator.cs:64
System.Linq.Parallel.NullableIntSumAggregationOperator.NullableIntSumAggregationOperator
NullableIntSumAggregationOperator(IEnumerable< int?> child)
Definition
NullableIntSumAggregationOperator.cs:48
System.Linq.Parallel.NullableIntSumAggregationOperator.InternalAggregate
override? int InternalAggregate(ref Exception singularExceptionToThrow)
Definition
NullableIntSumAggregationOperator.cs:53
System.Linq.Parallel.NullableIntSumAggregationOperator
Definition
NullableIntSumAggregationOperator.cs:7
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
NullableIntSumAggregationOperator.cs
Generated by
1.10.0