Table of Contents

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

generator IGenerator<TSource>

The generator.

predicate Func<TSource, bool>

The predicate.

Returns

IGenerator<TSource>

IGenerator<TSource>.

Type Parameters

TSource

The 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

generator IGenerator<TSource>
predicateGenerator IGenerator<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

generator IGenerator<T>
predicate Func<T, bool>
maxIterations int

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

generator IGenerator<T>
predicateGenerator IGenerator<bool>
maxIterations int

Returns

IGenerator<T>

Type Parameters

T