Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
GroupByIdentityQueryOperatorEnumerator.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
GroupByIdentityQueryOperatorEnumerator
<TSource,
TGroupKey
, TOrderKey> :
GroupByQueryOperatorEnumerator
<TSource, TGroupKey, TSource, TOrderKey>
7
{
8
internal
GroupByIdentityQueryOperatorEnumerator
(
QueryOperatorEnumerator
<
Pair<TSource, TGroupKey>
, TOrderKey>
source
,
IEqualityComparer<TGroupKey>
keyComparer,
CancellationToken
cancellationToken
)
9
:
base
(
source
, keyComparer,
cancellationToken
)
10
{
11
}
12
13
protected
override
HashLookup<Wrapper<TGroupKey>
,
ListChunk<TSource>
>
BuildHashLookup
()
14
{
15
HashLookup<Wrapper<TGroupKey>
,
ListChunk<TSource>
>
hashLookup
=
new
HashLookup<Wrapper<TGroupKey>
,
ListChunk<TSource>
>(
new
WrapperEqualityComparer<TGroupKey>
(
_keyComparer
));
16
Pair<TSource, TGroupKey>
currentElement
=
default
(
Pair<TSource, TGroupKey>
);
17
TOrderKey currentKey =
default
(TOrderKey);
18
int
num = 0;
19
while
(
_source
.MoveNext(
ref
currentElement
,
ref
currentKey))
20
{
21
if
((num++ & 0
x3F
) == 0)
22
{
23
_cancellationToken
.
ThrowIfCancellationRequested
();
24
}
25
Wrapper<TGroupKey>
key
=
new
Wrapper<TGroupKey>
(
currentElement
.Second);
26
ListChunk<TSource>
value
=
null
;
27
if
(!
hashLookup
.
TryGetValue
(
key
,
ref
value
))
28
{
29
value
=
new
ListChunk<TSource>
(2);
30
hashLookup
.
Add
(
key
,
value
);
31
}
32
value
.
Add
(
currentElement
.First);
33
}
34
return
hashLookup
;
35
}
36
}
System.Collections.Generic.Dictionary.TryGetValue
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
Definition
Dictionary.cs:1419
System.Collections.Generic.Dictionary.Add
void Add(TKey key, TValue value)
Definition
Dictionary.cs:873
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Linq.Parallel.GroupByIdentityQueryOperatorEnumerator.BuildHashLookup
override HashLookup< Wrapper< TGroupKey >, ListChunk< TSource > > BuildHashLookup()
Definition
GroupByIdentityQueryOperatorEnumerator.cs:13
System.Linq.Parallel.GroupByIdentityQueryOperatorEnumerator.GroupByIdentityQueryOperatorEnumerator
GroupByIdentityQueryOperatorEnumerator(QueryOperatorEnumerator< Pair< TSource, TGroupKey >, TOrderKey > source, IEqualityComparer< TGroupKey > keyComparer, CancellationToken cancellationToken)
Definition
GroupByIdentityQueryOperatorEnumerator.cs:8
System.Linq.Parallel.GroupByIdentityQueryOperatorEnumerator
Definition
GroupByIdentityQueryOperatorEnumerator.cs:7
System.Linq.Parallel.GroupByQueryOperatorEnumerator< TSource, TGroupKey, TSource, TOrderKey >::_cancellationToken
readonly CancellationToken _cancellationToken
Definition
GroupByQueryOperatorEnumerator.cs:20
System.Linq.Parallel.GroupByQueryOperatorEnumerator< TSource, TGroupKey, TSource, TOrderKey >::_keyComparer
readonly IEqualityComparer< TGroupKey > _keyComparer
Definition
GroupByQueryOperatorEnumerator.cs:18
System.Linq.Parallel.GroupByQueryOperatorEnumerator< TSource, TGroupKey, TSource, TOrderKey >::_source
readonly QueryOperatorEnumerator< Pair< TSource, TGroupKey >, TOrderKey > _source
Definition
GroupByQueryOperatorEnumerator.cs:16
System.Linq.Parallel.GroupByQueryOperatorEnumerator
Definition
GroupByQueryOperatorEnumerator.cs:8
System.Linq.Parallel.QueryOperatorEnumerator
Definition
QueryOperatorEnumerator.cs:8
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Linq.Parallel
Definition
AnyAllSearchOperator.cs:5
System.Linq.ExceptionArgument.source
@ source
System.Threading
Definition
TaskToApm.cs:3
System.ExceptionArgument.value
@ value
System.ExceptionArgument.key
@ key
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
GroupByIdentityQueryOperatorEnumerator.cs
Generated by
1.10.0