Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NullableDoubleMinMaxAggregationOperator.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
NullableDoubleMinMaxAggregationOperator
:
InlinedAggregationOperator
<double?, double?, double?>
7
{
8
private
sealed
class
NullableDoubleMinMaxAggregationOperatorEnumerator
<TKey> :
InlinedAggregationOperatorEnumerator
<double?>
9
{
10
private
readonly
QueryOperatorEnumerator<double?, TKey>
_source
;
11
12
private
readonly
int
_sign
;
13
14
internal
NullableDoubleMinMaxAggregationOperatorEnumerator
(
QueryOperatorEnumerator<double?, TKey>
source
,
int
partitionIndex
,
int
sign,
CancellationToken
cancellationToken
)
15
:
base
(
partitionIndex
,
cancellationToken
)
16
{
17
_source
=
source
;
18
_sign
= sign;
19
}
20
21
protected
override
bool
MoveNextCore
(
ref
double
?
currentElement
)
22
{
23
QueryOperatorEnumerator<double?, TKey>
source
=
_source
;
24
TKey currentKey =
default
(TKey);
25
if
(
source
.MoveNext(
ref
currentElement
,
ref
currentKey))
26
{
27
int
num = 0;
28
if
(
_sign
== -1)
29
{
30
double
?
currentElement2
=
null
;
31
while
(
source
.MoveNext(
ref
currentElement2
,
ref
currentKey))
32
{
33
if
((num++ & 0
x3F
) == 0)
34
{
35
_cancellationToken
.
ThrowIfCancellationRequested
();
36
}
37
if
(
currentElement2
.HasValue && (!
currentElement
.HasValue ||
currentElement2
<
currentElement
||
double
.IsNaN(
currentElement2
.GetValueOrDefault())))
38
{
39
currentElement
=
currentElement2
;
40
}
41
}
42
}
43
else
44
{
45
double
?
currentElement3
=
null
;
46
while
(
source
.MoveNext(
ref
currentElement3
,
ref
currentKey))
47
{
48
if
((num++ & 0
x3F
) == 0)
49
{
50
_cancellationToken
.
ThrowIfCancellationRequested
();
51
}
52
if
(
currentElement3
.HasValue && (!
currentElement
.HasValue ||
currentElement3
>
currentElement
||
double
.IsNaN(
currentElement
.GetValueOrDefault())))
53
{
54
currentElement
=
currentElement3
;
55
}
56
}
57
}
58
return
true
;
59
}
60
return
false
;
61
}
62
63
protected
override
void
Dispose
(
bool
disposing
)
64
{
65
_source
.
Dispose
();
66
}
67
}
68
69
private
readonly
int
_sign
;
70
71
internal
NullableDoubleMinMaxAggregationOperator
(
IEnumerable<double?>
child,
int
sign)
72
:
base
(child)
73
{
74
_sign
= sign;
75
}
76
77
protected
override
double
?
InternalAggregate
(
ref
Exception
singularExceptionToThrow
)
78
{
79
using
IEnumerator
<
double
?>
enumerator
= GetEnumerator(
ParallelMergeOptions
.FullyBuffered,
suppressOrderPreservation
:
true
);
80
if
(!
enumerator
.MoveNext())
81
{
82
return
null
;
83
}
84
double
? num =
enumerator
.Current;
85
if
(
_sign
== -1)
86
{
87
while
(
enumerator
.MoveNext())
88
{
89
double
? current =
enumerator
.Current;
90
if
(current.HasValue && (!num.HasValue || current < num ||
double
.IsNaN(current.GetValueOrDefault())))
91
{
92
num = current;
93
}
94
}
95
}
96
else
97
{
98
while
(
enumerator
.MoveNext())
99
{
100
double
?
current2
=
enumerator
.Current;
101
if
(
current2
.HasValue && (!num.HasValue ||
current2
> num ||
double
.IsNaN(num.GetValueOrDefault())))
102
{
103
num =
current2
;
104
}
105
}
106
}
107
return
num;
108
}
109
110
protected
override
QueryOperatorEnumerator<double?, int>
CreateEnumerator<TKey>
(
int
index
,
int
count
,
QueryOperatorEnumerator<double?, TKey>
source
,
object
sharedData
,
CancellationToken
cancellationToken
)
111
{
112
return
new
NullableDoubleMinMaxAggregationOperatorEnumerator<TKey>
(
source
,
index
,
_sign
,
cancellationToken
);
113
}
114
}
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.NullableDoubleMinMaxAggregationOperator.NullableDoubleMinMaxAggregationOperatorEnumerator.Dispose
override void Dispose(bool disposing)
Definition
NullableDoubleMinMaxAggregationOperator.cs:63
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator.NullableDoubleMinMaxAggregationOperatorEnumerator.NullableDoubleMinMaxAggregationOperatorEnumerator
NullableDoubleMinMaxAggregationOperatorEnumerator(QueryOperatorEnumerator< double?, TKey > source, int partitionIndex, int sign, CancellationToken cancellationToken)
Definition
NullableDoubleMinMaxAggregationOperator.cs:14
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator.NullableDoubleMinMaxAggregationOperatorEnumerator._source
readonly QueryOperatorEnumerator< double?, TKey > _source
Definition
NullableDoubleMinMaxAggregationOperator.cs:10
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator.NullableDoubleMinMaxAggregationOperatorEnumerator.MoveNextCore
override bool MoveNextCore(ref double? currentElement)
Definition
NullableDoubleMinMaxAggregationOperator.cs:21
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator.NullableDoubleMinMaxAggregationOperatorEnumerator._sign
readonly int _sign
Definition
NullableDoubleMinMaxAggregationOperator.cs:12
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator.NullableDoubleMinMaxAggregationOperatorEnumerator
Definition
NullableDoubleMinMaxAggregationOperator.cs:9
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator.CreateEnumerator< TKey >
override QueryOperatorEnumerator< double?, int > CreateEnumerator< TKey >(int index, int count, QueryOperatorEnumerator< double?, TKey > source, object sharedData, CancellationToken cancellationToken)
Definition
NullableDoubleMinMaxAggregationOperator.cs:110
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator.InternalAggregate
override? double InternalAggregate(ref Exception singularExceptionToThrow)
Definition
NullableDoubleMinMaxAggregationOperator.cs:77
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator._sign
readonly int _sign
Definition
NullableDoubleMinMaxAggregationOperator.cs:69
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator.NullableDoubleMinMaxAggregationOperator
NullableDoubleMinMaxAggregationOperator(IEnumerable< double?> child, int sign)
Definition
NullableDoubleMinMaxAggregationOperator.cs:71
System.Linq.Parallel.NullableDoubleMinMaxAggregationOperator
Definition
NullableDoubleMinMaxAggregationOperator.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
NullableDoubleMinMaxAggregationOperator.cs
Generated by
1.10.0