|
@@ -52,7 +52,6 @@ namespace System.Linq
|
|
|
if (selector == null)
|
|
|
throw Error.ArgumentNull(nameof(selector));
|
|
|
|
|
|
-#if USE_ASYNC_ITERATOR
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
@@ -74,9 +73,6 @@ namespace System.Linq
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
- return new SelectManyWithIndexAsyncIterator<TSource, TResult>(source, selector);
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
internal static IAsyncEnumerable<TResult> SelectManyAwaitCore<TSource, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, int, ValueTask<IAsyncEnumerable<TResult>>> selector)
|
|
@@ -86,7 +82,6 @@ namespace System.Linq
|
|
|
if (selector == null)
|
|
|
throw Error.ArgumentNull(nameof(selector));
|
|
|
|
|
|
-#if USE_ASYNC_ITERATOR
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
@@ -108,9 +103,6 @@ namespace System.Linq
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
- return new SelectManyWithIndexAsyncIteratorWithTask<TSource, TResult>(source, selector);
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
#if !NO_DEEP_CANCELLATION
|
|
@@ -121,7 +113,6 @@ namespace System.Linq
|
|
|
if (selector == null)
|
|
|
throw Error.ArgumentNull(nameof(selector));
|
|
|
|
|
|
-#if USE_ASYNC_ITERATOR
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
@@ -143,9 +134,6 @@ namespace System.Linq
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
- return new SelectManyWithIndexAsyncIteratorWithTaskAndCancellation<TSource, TResult>(source, selector);
|
|
|
-#endif
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -158,7 +146,6 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
-#if USE_ASYNC_ITERATOR
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
@@ -173,9 +160,6 @@ namespace System.Linq
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
- return new SelectManyAsyncIterator<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
internal static IAsyncEnumerable<TResult> SelectManyAwaitCore<TSource, TCollection, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<IAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, ValueTask<TResult>> resultSelector)
|
|
@@ -187,7 +171,6 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
-#if USE_ASYNC_ITERATOR
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
@@ -202,9 +185,6 @@ namespace System.Linq
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
- return new SelectManyAsyncIteratorWithTask<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
#if !NO_DEEP_CANCELLATION
|
|
@@ -217,7 +197,6 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
-#if USE_ASYNC_ITERATOR
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
@@ -232,9 +211,6 @@ namespace System.Linq
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
- return new SelectManyAsyncIteratorWithTaskAndCancellation<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
|
|
|
-#endif
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -247,7 +223,6 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
-#if USE_ASYNC_ITERATOR
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
@@ -269,9 +244,6 @@ namespace System.Linq
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
- return new SelectManyWithIndexAsyncIterator<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
internal static IAsyncEnumerable<TResult> SelectManyAwaitCore<TSource, TCollection, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, int, ValueTask<IAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, ValueTask<TResult>> resultSelector)
|
|
@@ -283,7 +255,6 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
-#if USE_ASYNC_ITERATOR
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
@@ -305,9 +276,6 @@ namespace System.Linq
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
- return new SelectManyWithIndexAsyncIteratorWithTask<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
#if !NO_DEEP_CANCELLATION
|
|
@@ -320,7 +288,6 @@ namespace System.Linq
|
|
|
if (resultSelector == null)
|
|
|
throw Error.ArgumentNull(nameof(resultSelector));
|
|
|
|
|
|
-#if USE_ASYNC_ITERATOR
|
|
|
return Create(Core);
|
|
|
|
|
|
async IAsyncEnumerator<TResult> Core(CancellationToken cancellationToken)
|
|
@@ -342,9 +309,6 @@ namespace System.Linq
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
- return new SelectManyWithIndexAsyncIteratorWithTaskAndCancellation<TSource, TCollection, TResult>(source, collectionSelector, resultSelector);
|
|
|
-#endif
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -769,920 +733,6 @@ namespace System.Linq
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
-#endif
|
|
|
-
|
|
|
-#if !USE_ASYNC_ITERATOR
|
|
|
- private sealed class SelectManyAsyncIterator<TSource, TCollection, TResult> : AsyncIterator<TResult>
|
|
|
- {
|
|
|
- private const int State_Source = 1;
|
|
|
- private const int State_Result = 2;
|
|
|
-
|
|
|
- private readonly Func<TSource, IAsyncEnumerable<TCollection>> _collectionSelector;
|
|
|
- private readonly Func<TSource, TCollection, TResult> _resultSelector;
|
|
|
- private readonly IAsyncEnumerable<TSource> _source;
|
|
|
-
|
|
|
- private TSource _currentSource;
|
|
|
- private int _mode;
|
|
|
- private IAsyncEnumerator<TCollection> _resultEnumerator;
|
|
|
- private IAsyncEnumerator<TSource> _sourceEnumerator;
|
|
|
-
|
|
|
- public SelectManyAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, IAsyncEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
|
|
|
- {
|
|
|
- Debug.Assert(source != null);
|
|
|
- Debug.Assert(collectionSelector != null);
|
|
|
- Debug.Assert(resultSelector != null);
|
|
|
-
|
|
|
- _source = source;
|
|
|
- _collectionSelector = collectionSelector;
|
|
|
- _resultSelector = resultSelector;
|
|
|
- }
|
|
|
-
|
|
|
- public override AsyncIteratorBase<TResult> Clone()
|
|
|
- {
|
|
|
- return new SelectManyAsyncIterator<TSource, TCollection, TResult>(_source, _collectionSelector, _resultSelector);
|
|
|
- }
|
|
|
-
|
|
|
- public override async ValueTask DisposeAsync()
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _resultEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (_sourceEnumerator != null)
|
|
|
- {
|
|
|
- await _sourceEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _sourceEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = default;
|
|
|
-
|
|
|
- await base.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- protected override async ValueTask<bool> MoveNextCore()
|
|
|
- {
|
|
|
- switch (_state)
|
|
|
- {
|
|
|
- case AsyncIteratorState.Allocated:
|
|
|
- _sourceEnumerator = _source.GetAsyncEnumerator(_cancellationToken);
|
|
|
- _mode = State_Source;
|
|
|
- _state = AsyncIteratorState.Iterating;
|
|
|
- goto case AsyncIteratorState.Iterating;
|
|
|
-
|
|
|
- case AsyncIteratorState.Iterating:
|
|
|
- switch (_mode)
|
|
|
- {
|
|
|
- case State_Source:
|
|
|
- if (await _sourceEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = _sourceEnumerator.Current;
|
|
|
- var inner = _collectionSelector(_currentSource);
|
|
|
- _resultEnumerator = inner.GetAsyncEnumerator(_cancellationToken);
|
|
|
-
|
|
|
- _mode = State_Result;
|
|
|
- goto case State_Result;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case State_Result:
|
|
|
- if (await _resultEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- _current = _resultSelector(_currentSource, _resultEnumerator.Current);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- _mode = State_Source;
|
|
|
- goto case State_Source; // loop
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- await DisposeAsync().ConfigureAwait(false);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private sealed class SelectManyAsyncIteratorWithTask<TSource, TCollection, TResult> : AsyncIterator<TResult>
|
|
|
- {
|
|
|
- private const int State_Source = 1;
|
|
|
- private const int State_Result = 2;
|
|
|
-
|
|
|
- private readonly Func<TSource, ValueTask<IAsyncEnumerable<TCollection>>> _collectionSelector;
|
|
|
- private readonly Func<TSource, TCollection, ValueTask<TResult>> _resultSelector;
|
|
|
- private readonly IAsyncEnumerable<TSource> _source;
|
|
|
-
|
|
|
- private TSource _currentSource;
|
|
|
- private int _mode;
|
|
|
- private IAsyncEnumerator<TCollection> _resultEnumerator;
|
|
|
- private IAsyncEnumerator<TSource> _sourceEnumerator;
|
|
|
-
|
|
|
- public SelectManyAsyncIteratorWithTask(IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<IAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, ValueTask<TResult>> resultSelector)
|
|
|
- {
|
|
|
- Debug.Assert(source != null);
|
|
|
- Debug.Assert(collectionSelector != null);
|
|
|
- Debug.Assert(resultSelector != null);
|
|
|
-
|
|
|
- _source = source;
|
|
|
- _collectionSelector = collectionSelector;
|
|
|
- _resultSelector = resultSelector;
|
|
|
- }
|
|
|
-
|
|
|
- public override AsyncIteratorBase<TResult> Clone()
|
|
|
- {
|
|
|
- return new SelectManyAsyncIteratorWithTask<TSource, TCollection, TResult>(_source, _collectionSelector, _resultSelector);
|
|
|
- }
|
|
|
-
|
|
|
- public override async ValueTask DisposeAsync()
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _resultEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (_sourceEnumerator != null)
|
|
|
- {
|
|
|
- await _sourceEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _sourceEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = default;
|
|
|
-
|
|
|
- await base.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- protected override async ValueTask<bool> MoveNextCore()
|
|
|
- {
|
|
|
- switch (_state)
|
|
|
- {
|
|
|
- case AsyncIteratorState.Allocated:
|
|
|
- _sourceEnumerator = _source.GetAsyncEnumerator(_cancellationToken);
|
|
|
- _mode = State_Source;
|
|
|
- _state = AsyncIteratorState.Iterating;
|
|
|
- goto case AsyncIteratorState.Iterating;
|
|
|
-
|
|
|
- case AsyncIteratorState.Iterating:
|
|
|
- switch (_mode)
|
|
|
- {
|
|
|
- case State_Source:
|
|
|
- if (await _sourceEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = _sourceEnumerator.Current;
|
|
|
- var inner = await _collectionSelector(_currentSource).ConfigureAwait(false);
|
|
|
- _resultEnumerator = inner.GetAsyncEnumerator(_cancellationToken);
|
|
|
-
|
|
|
- _mode = State_Result;
|
|
|
- goto case State_Result;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case State_Result:
|
|
|
- if (await _resultEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- _current = await _resultSelector(_currentSource, _resultEnumerator.Current).ConfigureAwait(false);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- _mode = State_Source;
|
|
|
- goto case State_Source; // loop
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- await DisposeAsync().ConfigureAwait(false);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-#if !NO_DEEP_CANCELLATION
|
|
|
- private sealed class SelectManyAsyncIteratorWithTaskAndCancellation<TSource, TCollection, TResult> : AsyncIterator<TResult>
|
|
|
- {
|
|
|
- private const int State_Source = 1;
|
|
|
- private const int State_Result = 2;
|
|
|
-
|
|
|
- private readonly Func<TSource, CancellationToken, ValueTask<IAsyncEnumerable<TCollection>>> _collectionSelector;
|
|
|
- private readonly Func<TSource, TCollection, CancellationToken, ValueTask<TResult>> _resultSelector;
|
|
|
- private readonly IAsyncEnumerable<TSource> _source;
|
|
|
-
|
|
|
- private TSource _currentSource;
|
|
|
- private int _mode;
|
|
|
- private IAsyncEnumerator<TCollection> _resultEnumerator;
|
|
|
- private IAsyncEnumerator<TSource> _sourceEnumerator;
|
|
|
-
|
|
|
- public SelectManyAsyncIteratorWithTaskAndCancellation(IAsyncEnumerable<TSource> source, Func<TSource, CancellationToken, ValueTask<IAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, CancellationToken, ValueTask<TResult>> resultSelector)
|
|
|
- {
|
|
|
- Debug.Assert(source != null);
|
|
|
- Debug.Assert(collectionSelector != null);
|
|
|
- Debug.Assert(resultSelector != null);
|
|
|
-
|
|
|
- _source = source;
|
|
|
- _collectionSelector = collectionSelector;
|
|
|
- _resultSelector = resultSelector;
|
|
|
- }
|
|
|
-
|
|
|
- public override AsyncIteratorBase<TResult> Clone()
|
|
|
- {
|
|
|
- return new SelectManyAsyncIteratorWithTaskAndCancellation<TSource, TCollection, TResult>(_source, _collectionSelector, _resultSelector);
|
|
|
- }
|
|
|
-
|
|
|
- public override async ValueTask DisposeAsync()
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _resultEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (_sourceEnumerator != null)
|
|
|
- {
|
|
|
- await _sourceEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _sourceEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = default;
|
|
|
-
|
|
|
- await base.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- protected override async ValueTask<bool> MoveNextCore()
|
|
|
- {
|
|
|
- switch (_state)
|
|
|
- {
|
|
|
- case AsyncIteratorState.Allocated:
|
|
|
- _sourceEnumerator = _source.GetAsyncEnumerator(_cancellationToken);
|
|
|
- _mode = State_Source;
|
|
|
- _state = AsyncIteratorState.Iterating;
|
|
|
- goto case AsyncIteratorState.Iterating;
|
|
|
-
|
|
|
- case AsyncIteratorState.Iterating:
|
|
|
- switch (_mode)
|
|
|
- {
|
|
|
- case State_Source:
|
|
|
- if (await _sourceEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = _sourceEnumerator.Current;
|
|
|
- var inner = await _collectionSelector(_currentSource, _cancellationToken).ConfigureAwait(false);
|
|
|
- _resultEnumerator = inner.GetAsyncEnumerator(_cancellationToken);
|
|
|
-
|
|
|
- _mode = State_Result;
|
|
|
- goto case State_Result;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case State_Result:
|
|
|
- if (await _resultEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- _current = await _resultSelector(_currentSource, _resultEnumerator.Current, _cancellationToken).ConfigureAwait(false);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- _mode = State_Source;
|
|
|
- goto case State_Source; // loop
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- await DisposeAsync().ConfigureAwait(false);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-#endif
|
|
|
-
|
|
|
- private sealed class SelectManyWithIndexAsyncIterator<TSource, TCollection, TResult> : AsyncIterator<TResult>
|
|
|
- {
|
|
|
- private const int State_Source = 1;
|
|
|
- private const int State_Result = 2;
|
|
|
-
|
|
|
- private readonly Func<TSource, int, IAsyncEnumerable<TCollection>> _collectionSelector;
|
|
|
- private readonly Func<TSource, TCollection, TResult> _resultSelector;
|
|
|
- private readonly IAsyncEnumerable<TSource> _source;
|
|
|
-
|
|
|
- private TSource _currentSource;
|
|
|
- private int _index;
|
|
|
- private int _mode;
|
|
|
- private IAsyncEnumerator<TCollection> _resultEnumerator;
|
|
|
- private IAsyncEnumerator<TSource> _sourceEnumerator;
|
|
|
-
|
|
|
- public SelectManyWithIndexAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, int, IAsyncEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
|
|
|
- {
|
|
|
- Debug.Assert(source != null);
|
|
|
- Debug.Assert(collectionSelector != null);
|
|
|
- Debug.Assert(resultSelector != null);
|
|
|
-
|
|
|
- _source = source;
|
|
|
- _collectionSelector = collectionSelector;
|
|
|
- _resultSelector = resultSelector;
|
|
|
- }
|
|
|
-
|
|
|
- public override AsyncIteratorBase<TResult> Clone()
|
|
|
- {
|
|
|
- return new SelectManyWithIndexAsyncIterator<TSource, TCollection, TResult>(_source, _collectionSelector, _resultSelector);
|
|
|
- }
|
|
|
-
|
|
|
- public override async ValueTask DisposeAsync()
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _resultEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (_sourceEnumerator != null)
|
|
|
- {
|
|
|
- await _sourceEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _sourceEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = default;
|
|
|
-
|
|
|
- await base.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- protected override async ValueTask<bool> MoveNextCore()
|
|
|
- {
|
|
|
- switch (_state)
|
|
|
- {
|
|
|
- case AsyncIteratorState.Allocated:
|
|
|
- _sourceEnumerator = _source.GetAsyncEnumerator(_cancellationToken);
|
|
|
- _index = -1;
|
|
|
- _mode = State_Source;
|
|
|
- _state = AsyncIteratorState.Iterating;
|
|
|
- goto case AsyncIteratorState.Iterating;
|
|
|
-
|
|
|
- case AsyncIteratorState.Iterating:
|
|
|
- switch (_mode)
|
|
|
- {
|
|
|
- case State_Source:
|
|
|
- if (await _sourceEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = _sourceEnumerator.Current;
|
|
|
-
|
|
|
- checked
|
|
|
- {
|
|
|
- _index++;
|
|
|
- }
|
|
|
-
|
|
|
- var inner = _collectionSelector(_currentSource, _index);
|
|
|
- _resultEnumerator = inner.GetAsyncEnumerator(_cancellationToken);
|
|
|
-
|
|
|
- _mode = State_Result;
|
|
|
- goto case State_Result;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case State_Result:
|
|
|
- if (await _resultEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- _current = _resultSelector(_currentSource, _resultEnumerator.Current);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- _mode = State_Source;
|
|
|
- goto case State_Source; // loop
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- await DisposeAsync().ConfigureAwait(false);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private sealed class SelectManyWithIndexAsyncIteratorWithTask<TSource, TCollection, TResult> : AsyncIterator<TResult>
|
|
|
- {
|
|
|
- private const int State_Source = 1;
|
|
|
- private const int State_Result = 2;
|
|
|
-
|
|
|
- private readonly Func<TSource, int, ValueTask<IAsyncEnumerable<TCollection>>> _collectionSelector;
|
|
|
- private readonly Func<TSource, TCollection, ValueTask<TResult>> _resultSelector;
|
|
|
- private readonly IAsyncEnumerable<TSource> _source;
|
|
|
-
|
|
|
- private TSource _currentSource;
|
|
|
- private int _index;
|
|
|
- private int _mode;
|
|
|
- private IAsyncEnumerator<TCollection> _resultEnumerator;
|
|
|
- private IAsyncEnumerator<TSource> _sourceEnumerator;
|
|
|
-
|
|
|
- public SelectManyWithIndexAsyncIteratorWithTask(IAsyncEnumerable<TSource> source, Func<TSource, int, ValueTask<IAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, ValueTask<TResult>> resultSelector)
|
|
|
- {
|
|
|
- Debug.Assert(source != null);
|
|
|
- Debug.Assert(collectionSelector != null);
|
|
|
- Debug.Assert(resultSelector != null);
|
|
|
-
|
|
|
- _source = source;
|
|
|
- _collectionSelector = collectionSelector;
|
|
|
- _resultSelector = resultSelector;
|
|
|
- }
|
|
|
-
|
|
|
- public override AsyncIteratorBase<TResult> Clone()
|
|
|
- {
|
|
|
- return new SelectManyWithIndexAsyncIteratorWithTask<TSource, TCollection, TResult>(_source, _collectionSelector, _resultSelector);
|
|
|
- }
|
|
|
-
|
|
|
- public override async ValueTask DisposeAsync()
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _resultEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (_sourceEnumerator != null)
|
|
|
- {
|
|
|
- await _sourceEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _sourceEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = default;
|
|
|
-
|
|
|
- await base.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- protected override async ValueTask<bool> MoveNextCore()
|
|
|
- {
|
|
|
- switch (_state)
|
|
|
- {
|
|
|
- case AsyncIteratorState.Allocated:
|
|
|
- _sourceEnumerator = _source.GetAsyncEnumerator(_cancellationToken);
|
|
|
- _index = -1;
|
|
|
- _mode = State_Source;
|
|
|
- _state = AsyncIteratorState.Iterating;
|
|
|
- goto case AsyncIteratorState.Iterating;
|
|
|
-
|
|
|
- case AsyncIteratorState.Iterating:
|
|
|
- switch (_mode)
|
|
|
- {
|
|
|
- case State_Source:
|
|
|
- if (await _sourceEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = _sourceEnumerator.Current;
|
|
|
-
|
|
|
- checked
|
|
|
- {
|
|
|
- _index++;
|
|
|
- }
|
|
|
-
|
|
|
- var inner = await _collectionSelector(_currentSource, _index).ConfigureAwait(false);
|
|
|
- _resultEnumerator = inner.GetAsyncEnumerator(_cancellationToken);
|
|
|
-
|
|
|
- _mode = State_Result;
|
|
|
- goto case State_Result;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case State_Result:
|
|
|
- if (await _resultEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- _current = await _resultSelector(_currentSource, _resultEnumerator.Current).ConfigureAwait(false);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- _mode = State_Source;
|
|
|
- goto case State_Source; // loop
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- await DisposeAsync().ConfigureAwait(false);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-#if !NO_DEEP_CANCELLATION
|
|
|
- private sealed class SelectManyWithIndexAsyncIteratorWithTaskAndCancellation<TSource, TCollection, TResult> : AsyncIterator<TResult>
|
|
|
- {
|
|
|
- private const int State_Source = 1;
|
|
|
- private const int State_Result = 2;
|
|
|
-
|
|
|
- private readonly Func<TSource, int, CancellationToken, ValueTask<IAsyncEnumerable<TCollection>>> _collectionSelector;
|
|
|
- private readonly Func<TSource, TCollection, CancellationToken, ValueTask<TResult>> _resultSelector;
|
|
|
- private readonly IAsyncEnumerable<TSource> _source;
|
|
|
-
|
|
|
- private TSource _currentSource;
|
|
|
- private int _index;
|
|
|
- private int _mode;
|
|
|
- private IAsyncEnumerator<TCollection> _resultEnumerator;
|
|
|
- private IAsyncEnumerator<TSource> _sourceEnumerator;
|
|
|
-
|
|
|
- public SelectManyWithIndexAsyncIteratorWithTaskAndCancellation(IAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, ValueTask<IAsyncEnumerable<TCollection>>> collectionSelector, Func<TSource, TCollection, CancellationToken, ValueTask<TResult>> resultSelector)
|
|
|
- {
|
|
|
- Debug.Assert(source != null);
|
|
|
- Debug.Assert(collectionSelector != null);
|
|
|
- Debug.Assert(resultSelector != null);
|
|
|
-
|
|
|
- _source = source;
|
|
|
- _collectionSelector = collectionSelector;
|
|
|
- _resultSelector = resultSelector;
|
|
|
- }
|
|
|
-
|
|
|
- public override AsyncIteratorBase<TResult> Clone()
|
|
|
- {
|
|
|
- return new SelectManyWithIndexAsyncIteratorWithTaskAndCancellation<TSource, TCollection, TResult>(_source, _collectionSelector, _resultSelector);
|
|
|
- }
|
|
|
-
|
|
|
- public override async ValueTask DisposeAsync()
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _resultEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (_sourceEnumerator != null)
|
|
|
- {
|
|
|
- await _sourceEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _sourceEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = default;
|
|
|
-
|
|
|
- await base.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- protected override async ValueTask<bool> MoveNextCore()
|
|
|
- {
|
|
|
- switch (_state)
|
|
|
- {
|
|
|
- case AsyncIteratorState.Allocated:
|
|
|
- _sourceEnumerator = _source.GetAsyncEnumerator(_cancellationToken);
|
|
|
- _index = -1;
|
|
|
- _mode = State_Source;
|
|
|
- _state = AsyncIteratorState.Iterating;
|
|
|
- goto case AsyncIteratorState.Iterating;
|
|
|
-
|
|
|
- case AsyncIteratorState.Iterating:
|
|
|
- switch (_mode)
|
|
|
- {
|
|
|
- case State_Source:
|
|
|
- if (await _sourceEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- _currentSource = _sourceEnumerator.Current;
|
|
|
-
|
|
|
- checked
|
|
|
- {
|
|
|
- _index++;
|
|
|
- }
|
|
|
-
|
|
|
- var inner = await _collectionSelector(_currentSource, _index, _cancellationToken).ConfigureAwait(false);
|
|
|
- _resultEnumerator = inner.GetAsyncEnumerator(_cancellationToken);
|
|
|
-
|
|
|
- _mode = State_Result;
|
|
|
- goto case State_Result;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case State_Result:
|
|
|
- if (await _resultEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- _current = await _resultSelector(_currentSource, _resultEnumerator.Current, _cancellationToken).ConfigureAwait(false);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- _mode = State_Source;
|
|
|
- goto case State_Source; // loop
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- await DisposeAsync().ConfigureAwait(false);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-#endif
|
|
|
-
|
|
|
- private sealed class SelectManyWithIndexAsyncIterator<TSource, TResult> : AsyncIterator<TResult>
|
|
|
- {
|
|
|
- private const int State_Source = 1;
|
|
|
- private const int State_Result = 2;
|
|
|
-
|
|
|
- private readonly Func<TSource, int, IAsyncEnumerable<TResult>> _selector;
|
|
|
- private readonly IAsyncEnumerable<TSource> _source;
|
|
|
-
|
|
|
- private int _index;
|
|
|
- private int _mode;
|
|
|
- private IAsyncEnumerator<TResult> _resultEnumerator;
|
|
|
- private IAsyncEnumerator<TSource> _sourceEnumerator;
|
|
|
-
|
|
|
- public SelectManyWithIndexAsyncIterator(IAsyncEnumerable<TSource> source, Func<TSource, int, IAsyncEnumerable<TResult>> selector)
|
|
|
- {
|
|
|
- Debug.Assert(source != null);
|
|
|
- Debug.Assert(selector != null);
|
|
|
-
|
|
|
- _source = source;
|
|
|
- _selector = selector;
|
|
|
- }
|
|
|
-
|
|
|
- public override AsyncIteratorBase<TResult> Clone()
|
|
|
- {
|
|
|
- return new SelectManyWithIndexAsyncIterator<TSource, TResult>(_source, _selector);
|
|
|
- }
|
|
|
-
|
|
|
- public override async ValueTask DisposeAsync()
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _resultEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (_sourceEnumerator != null)
|
|
|
- {
|
|
|
- await _sourceEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _sourceEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- await base.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- protected override async ValueTask<bool> MoveNextCore()
|
|
|
- {
|
|
|
- switch (_state)
|
|
|
- {
|
|
|
- case AsyncIteratorState.Allocated:
|
|
|
- _sourceEnumerator = _source.GetAsyncEnumerator(_cancellationToken);
|
|
|
- _index = -1;
|
|
|
- _mode = State_Source;
|
|
|
- _state = AsyncIteratorState.Iterating;
|
|
|
- goto case AsyncIteratorState.Iterating;
|
|
|
-
|
|
|
- case AsyncIteratorState.Iterating:
|
|
|
- switch (_mode)
|
|
|
- {
|
|
|
- case State_Source:
|
|
|
- if (await _sourceEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- checked
|
|
|
- {
|
|
|
- _index++;
|
|
|
- }
|
|
|
-
|
|
|
- var inner = _selector(_sourceEnumerator.Current, _index);
|
|
|
- _resultEnumerator = inner.GetAsyncEnumerator(_cancellationToken);
|
|
|
-
|
|
|
- _mode = State_Result;
|
|
|
- goto case State_Result;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case State_Result:
|
|
|
- if (await _resultEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- _current = _resultEnumerator.Current;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- _mode = State_Source;
|
|
|
- goto case State_Source; // loop
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- await DisposeAsync().ConfigureAwait(false);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private sealed class SelectManyWithIndexAsyncIteratorWithTask<TSource, TResult> : AsyncIterator<TResult>
|
|
|
- {
|
|
|
- private const int State_Source = 1;
|
|
|
- private const int State_Result = 2;
|
|
|
-
|
|
|
- private readonly Func<TSource, int, ValueTask<IAsyncEnumerable<TResult>>> _selector;
|
|
|
- private readonly IAsyncEnumerable<TSource> _source;
|
|
|
-
|
|
|
- private int _index;
|
|
|
- private int _mode;
|
|
|
- private IAsyncEnumerator<TResult> _resultEnumerator;
|
|
|
- private IAsyncEnumerator<TSource> _sourceEnumerator;
|
|
|
-
|
|
|
- public SelectManyWithIndexAsyncIteratorWithTask(IAsyncEnumerable<TSource> source, Func<TSource, int, ValueTask<IAsyncEnumerable<TResult>>> selector)
|
|
|
- {
|
|
|
- Debug.Assert(source != null);
|
|
|
- Debug.Assert(selector != null);
|
|
|
-
|
|
|
- _source = source;
|
|
|
- _selector = selector;
|
|
|
- }
|
|
|
-
|
|
|
- public override AsyncIteratorBase<TResult> Clone()
|
|
|
- {
|
|
|
- return new SelectManyWithIndexAsyncIteratorWithTask<TSource, TResult>(_source, _selector);
|
|
|
- }
|
|
|
-
|
|
|
- public override async ValueTask DisposeAsync()
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _resultEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (_sourceEnumerator != null)
|
|
|
- {
|
|
|
- await _sourceEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _sourceEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- await base.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- protected override async ValueTask<bool> MoveNextCore()
|
|
|
- {
|
|
|
- switch (_state)
|
|
|
- {
|
|
|
- case AsyncIteratorState.Allocated:
|
|
|
- _sourceEnumerator = _source.GetAsyncEnumerator(_cancellationToken);
|
|
|
- _index = -1;
|
|
|
- _mode = State_Source;
|
|
|
- _state = AsyncIteratorState.Iterating;
|
|
|
- goto case AsyncIteratorState.Iterating;
|
|
|
-
|
|
|
- case AsyncIteratorState.Iterating:
|
|
|
- switch (_mode)
|
|
|
- {
|
|
|
- case State_Source:
|
|
|
- if (await _sourceEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- checked
|
|
|
- {
|
|
|
- _index++;
|
|
|
- }
|
|
|
-
|
|
|
- var inner = await _selector(_sourceEnumerator.Current, _index).ConfigureAwait(false);
|
|
|
- _resultEnumerator = inner.GetAsyncEnumerator(_cancellationToken);
|
|
|
-
|
|
|
- _mode = State_Result;
|
|
|
- goto case State_Result;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case State_Result:
|
|
|
- if (await _resultEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- _current = _resultEnumerator.Current;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- _mode = State_Source;
|
|
|
- goto case State_Source; // loop
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- await DisposeAsync().ConfigureAwait(false);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-#if !NO_DEEP_CANCELLATION
|
|
|
- private sealed class SelectManyWithIndexAsyncIteratorWithTaskAndCancellation<TSource, TResult> : AsyncIterator<TResult>
|
|
|
- {
|
|
|
- private const int State_Source = 1;
|
|
|
- private const int State_Result = 2;
|
|
|
-
|
|
|
- private readonly Func<TSource, int, CancellationToken, ValueTask<IAsyncEnumerable<TResult>>> _selector;
|
|
|
- private readonly IAsyncEnumerable<TSource> _source;
|
|
|
-
|
|
|
- private int _index;
|
|
|
- private int _mode;
|
|
|
- private IAsyncEnumerator<TResult> _resultEnumerator;
|
|
|
- private IAsyncEnumerator<TSource> _sourceEnumerator;
|
|
|
-
|
|
|
- public SelectManyWithIndexAsyncIteratorWithTaskAndCancellation(IAsyncEnumerable<TSource> source, Func<TSource, int, CancellationToken, ValueTask<IAsyncEnumerable<TResult>>> selector)
|
|
|
- {
|
|
|
- Debug.Assert(source != null);
|
|
|
- Debug.Assert(selector != null);
|
|
|
-
|
|
|
- _source = source;
|
|
|
- _selector = selector;
|
|
|
- }
|
|
|
-
|
|
|
- public override AsyncIteratorBase<TResult> Clone()
|
|
|
- {
|
|
|
- return new SelectManyWithIndexAsyncIteratorWithTaskAndCancellation<TSource, TResult>(_source, _selector);
|
|
|
- }
|
|
|
-
|
|
|
- public override async ValueTask DisposeAsync()
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _resultEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- if (_sourceEnumerator != null)
|
|
|
- {
|
|
|
- await _sourceEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- _sourceEnumerator = null;
|
|
|
- }
|
|
|
-
|
|
|
- await base.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- protected override async ValueTask<bool> MoveNextCore()
|
|
|
- {
|
|
|
- switch (_state)
|
|
|
- {
|
|
|
- case AsyncIteratorState.Allocated:
|
|
|
- _sourceEnumerator = _source.GetAsyncEnumerator(_cancellationToken);
|
|
|
- _index = -1;
|
|
|
- _mode = State_Source;
|
|
|
- _state = AsyncIteratorState.Iterating;
|
|
|
- goto case AsyncIteratorState.Iterating;
|
|
|
-
|
|
|
- case AsyncIteratorState.Iterating:
|
|
|
- switch (_mode)
|
|
|
- {
|
|
|
- case State_Source:
|
|
|
- if (await _sourceEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- if (_resultEnumerator != null)
|
|
|
- {
|
|
|
- await _resultEnumerator.DisposeAsync().ConfigureAwait(false);
|
|
|
- }
|
|
|
-
|
|
|
- checked
|
|
|
- {
|
|
|
- _index++;
|
|
|
- }
|
|
|
-
|
|
|
- var inner = await _selector(_sourceEnumerator.Current, _index, _cancellationToken).ConfigureAwait(false);
|
|
|
- _resultEnumerator = inner.GetAsyncEnumerator(_cancellationToken);
|
|
|
-
|
|
|
- _mode = State_Result;
|
|
|
- goto case State_Result;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case State_Result:
|
|
|
- if (await _resultEnumerator.MoveNextAsync().ConfigureAwait(false))
|
|
|
- {
|
|
|
- _current = _resultEnumerator.Current;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- _mode = State_Source;
|
|
|
- goto case State_Source; // loop
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- await DisposeAsync().ConfigureAwait(false);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-#endif
|
|
|
#endif
|
|
|
}
|
|
|
}
|