Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static method: IEnumerable<T> ReduceRequiredSet<T>(IEnumerable<T>, Func<Ut.ReduceRequiredSetState<T>, bool>, bool, bool)

  • Declared in: RT.Util.Ut

Declaration

public static IEnumerable<T> ReduceRequiredSet<T>(
    IEnumerable<T> items,
    Func<Ut.ReduceRequiredSetState<T>, bool> test,
    bool breadthFirst = false,
    bool skipConsistencyTest = false
)

Summary

Given a set of values and a function that returns true when given this set, will efficiently remove items from this set which are not essential for making the function return true. The relative order of items is preserved. This method cannot generally guarantee that the result is optimal, but for some types of functions the result will be guaranteed optimal.

Generic type parameters

T Type of the values in the set.

Parameters

IEnumerable<T>items The set of items to reduce.
Func<Ut.ReduceRequiredSetState<T>, bool>test The function that examines the set. Must always return the same value for the same set.
boolbreadthFirst A value selecting a breadth-first or a depth-first approach. Depth-first is best at quickly locating a single value which will be present in the final required set. Breadth-first is best at quickly placing a lower bound on the total number of individual items in the required set.
boolskipConsistencyTest When the function is particularly slow, you might want to set this to true to disable calls which are not required to reduce the set and are only there to ensure that the function behaves consistently.

Returns

A hopefully smaller set of values that still causes the function to return true.