Method Where
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
Where<TSource>(IGenerator<TSource>, Func<TSource, bool>)
Makes a generator that will only generate elements that pass the predicate.
public static IGenerator<TSource> Where<TSource>(this IGenerator<TSource> generator, Func<TSource, bool> predicate)
Parameters
generatorIGenerator<TSource>The generator.
predicateFunc<TSource, bool>The predicate.
Returns
- IGenerator<TSource>
IGenerator<TSource>.
Type Parameters
TSourceThe type of the source generator.
Where<TSource>(IGenerator<TSource>, IGenerator<bool>)
Makes a generator that will only generate elements that pass the predicate generated by the predicate generator.
public static IGenerator<TSource> Where<TSource>(this IGenerator<TSource> generator, IGenerator<bool> predicateGenerator)
Parameters
generatorIGenerator<TSource>predicateGeneratorIGenerator<bool>
Returns
- IGenerator<TSource>
Type Parameters
TSource
Where<T>(IGenerator<T>, Func<T, bool>, int)
Makes a generator that will only generate elements that pass the predicate. If the source elements does not provide elements that pass the predicate for the given number of maximum iterations, an exception is thrown. This is to prevent a stalling the generator forever.
public static IGenerator<T> Where<T>(this IGenerator<T> generator, Func<T, bool> predicate, int maxIterations)
Parameters
generatorIGenerator<T>predicateFunc<T, bool>maxIterationsint
Returns
- IGenerator<T>
Type Parameters
T
Where<T>(IGenerator<T>, IGenerator<bool>, int)
Makes a generator that will only generate elements that pass the predicate generated by the predicate generator. If the source elements does not provide elements that pass the predicate for the given number of maximum iterations, an exception is thrown. This is to prevent a stalling the generator forever.
public static IGenerator<T> Where<T>(this IGenerator<T> generator, IGenerator<bool> predicateGenerator, int maxIterations)
Parameters
generatorIGenerator<T>predicateGeneratorIGenerator<bool>maxIterationsint
Returns
- IGenerator<T>
Type Parameters
T