public static TAccumulator Inject <TAccumulator, T>(this IComposite <T> composite, TAccumulator accumulatorStartValue, Func <TAccumulator, T, TAccumulator> lambda, TreeTraversalStrategy str) { var func = str.Traversal <T>(); return(func(composite).Inject(accumulatorStartValue, lambda)); }
public static IEnumerable <T> Where <T>(this IComposite <T> composite, Func <T, bool> predicate, TreeTraversalStrategy str) { var func = str.Traversal <T>(); return(func(composite).Where(predicate)); }
public static IEnumerable <T> Select <T>(this IComposite <T> composite, Func <T, T> selector, TreeTraversalStrategy str) { var func = str.Traversal <T>(); return(func(composite).Select(selector)); }
/// <summary> /// applies an action to each content element of a composite, in the order given by a tree traversal strategy /// </summary> /// <typeparam name="T">the type of content element contained in the composite</typeparam> /// <param name="composite">the composite to iterate over</param> /// <param name="action">the action to apply</param> /// <param name="str">the tree traversal strategy to use</param> public static void Each <T>(this IComposite <T> composite, Action <T> action, TreeTraversalStrategy str) { var func = str.Traversal <T>(); func(composite).Each(action); }