Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        /// <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);
        }