NanoByte.Common
2.6.1
|
Splits collections into multiple buckets based on predicate matching. The first matching predicate wins. Create with Bucketizer.Bucketize<T>. More...
Public Member Functions | |
Bucketizer< T > | Add (Predicate< T > predicate, ICollection< T > bucket) |
Adds a new bucket rule. More... | |
void | Run () |
Adds each element to the first bucket with a matching predicate (if any). Set up with Add first. More... | |
IEnumerator< BucketRule< T > > | GetEnumerator () |
Bucketizer< TElement, TValue > | Add (TValue value, ICollection< TElement > bucket) |
Adds a new bucket rule. More... | |
void | Run () |
Adds each element to the first bucket with a matching value (if any). Set up with Add first. More... | |
IEnumerator< BucketRule< TElement, TValue > > | GetEnumerator () |
Static Public Member Functions | |
static Bucketizer< T > | Bucketize< T > (this IEnumerable< T > elements) |
Creates a new predicate-matching bucketizer. More... | |
static Bucketizer< TElement, TValue > | Bucketize< TElement, TValue > (this IEnumerable< TElement > elements, Func< TElement, TValue > valueRetriever) |
Creates a new value-mapping bucketizer. More... | |
Package Functions | |
Bucketizer (IEnumerable< T > elements) | |
Creates a new predicate-matching bucketizer. More... | |
Bucketizer (IEnumerable< TElement > elements, Func< TElement, TValue > valueRetriever) | |
Creates a new value-mapping bucketizer. More... | |
Splits collections into multiple buckets based on predicate matching. The first matching predicate wins. Create with Bucketizer.Bucketize<T>.
Splits collections into multiple buckets based on value-mapping. Create with Bucketizer.Bucketize<TElement,TValue>.
Contains extension methods for creating bucketizers.
T | The common base type of all objects to be bucketized. |
TElement | The common base type of all objects to be bucketized. |
TValue | The type of the values to be matched. |
|
inlinepackage |
Creates a new predicate-matching bucketizer.
elements | The elements to be bucketized. |
|
inlinepackage |
Creates a new value-mapping bucketizer.
elements | The elements to be bucketized. |
valueRetriever | A function to map elements to their according values used for bucketization. |
|
inline |
Adds a new bucket rule.
predicate | A condition to check elements against. |
bucket | The collection elements are added to if they match the predicate . |
|
inline |
Adds a new bucket rule.
value | A value to compare with the result of the value retriever using object.Equals(object,object). |
bucket | The collection elements are added to if they match the value . |
|
static |
Creates a new predicate-matching bucketizer.
elements | The elements to be bucketized. |
|
static |
Creates a new value-mapping bucketizer.
elements | The elements to be bucketized. |
valueRetriever | A function to map elements to their according values used for bucketization. |
|
inline |
Adds each element to the first bucket with a matching predicate (if any). Set up with Add first.
|
inline |
Adds each element to the first bucket with a matching value (if any). Set up with Add first.