Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NullableFloatSumAggregationOperator.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
NullableFloatSumAggregationOperator
:
InlinedAggregationOperator
<float?, double?, float?>
7
{
8
private
sealed
class
NullableFloatSumAggregationOperatorEnumerator
<TKey> :
InlinedAggregationOperatorEnumerator
<double?>
9
{
10
private
readonly
QueryOperatorEnumerator<float?, TKey>
_source
;
11
12
internal
NullableFloatSumAggregationOperatorEnumerator
(
QueryOperatorEnumerator<float?, 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
float
?
currentElement2
=
null
;
21
TKey currentKey =
default
(TKey);
22
QueryOperatorEnumerator<float?, 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 += (double)
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
NullableFloatSumAggregationOperator
(
IEnumerable<float?>
child)
49
:
base
(child)
50
{
51
}
52
53
protected
override
float
?
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.GetValueOrDefault();
60
}
61
return
(
float
)num;
62
}
63
64
protected
override
QueryOperatorEnumerator<double?, int>
CreateEnumerator<TKey>
(
int
index
,
int
count
,
QueryOperatorEnumerator<float?, TKey>
source
,
object
sharedData
,
CancellationToken
cancellationToken
)
65
{
66
return
new
NullableFloatSumAggregationOperatorEnumerator<TKey>
(
source
,
index
,
cancellationToken
);
67
}
68
}
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Exception
Definition
Exception.cs:15
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.NullableFloatSumAggregationOperator.NullableFloatSumAggregationOperatorEnumerator.NullableFloatSumAggregationOperatorEnumerator
NullableFloatSumAggregationOperatorEnumerator(QueryOperatorEnumerator< float?, TKey > source, int partitionIndex, CancellationToken cancellationToken)
Definition
NullableFloatSumAggregationOperator.cs:12
System.Linq.Parallel.NullableFloatSumAggregationOperator.NullableFloatSumAggregationOperatorEnumerator.Dispose
override void Dispose(bool disposing)
Definition
NullableFloatSumAggregationOperator.cs:42
System.Linq.Parallel.NullableFloatSumAggregationOperator.NullableFloatSumAggregationOperatorEnumerator.MoveNextCore
override bool MoveNextCore(ref double? currentElement)
Definition
NullableFloatSumAggregationOperator.cs:18
System.Linq.Parallel.NullableFloatSumAggregationOperator.NullableFloatSumAggregationOperatorEnumerator._source
readonly QueryOperatorEnumerator< float?, TKey > _source
Definition
NullableFloatSumAggregationOperator.cs:10
System.Linq.Parallel.NullableFloatSumAggregationOperator.NullableFloatSumAggregationOperatorEnumerator
Definition
NullableFloatSumAggregationOperator.cs:9
System.Linq.Parallel.NullableFloatSumAggregationOperator.NullableFloatSumAggregationOperator
NullableFloatSumAggregationOperator(IEnumerable< float?> child)
Definition
NullableFloatSumAggregationOperator.cs:48
System.Linq.Parallel.NullableFloatSumAggregationOperator.CreateEnumerator< TKey >
override QueryOperatorEnumerator< double?, int > CreateEnumerator< TKey >(int index, int count, QueryOperatorEnumerator< float?, TKey > source, object sharedData, CancellationToken cancellationToken)
Definition
NullableFloatSumAggregationOperator.cs:64
System.Linq.Parallel.NullableFloatSumAggregationOperator.InternalAggregate
override? float InternalAggregate(ref Exception singularExceptionToThrow)
Definition
NullableFloatSumAggregationOperator.cs:53
System.Linq.Parallel.NullableFloatSumAggregationOperator
Definition
NullableFloatSumAggregationOperator.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
NullableFloatSumAggregationOperator.cs
Generated by
1.10.0