Exemplo n.º 1
0
        static IPipe <TOutput> BuildOutputPipe(IFilter <TOutput>[] filters)
        {
            if (filters.Length == 0)
            {
                throw new ArgumentException("There must be at least one filter, the output filter, for the output pipe");
            }

            IPipe <TOutput> current = new LastPipe <TOutput>(filters[filters.Length - 1]);

            for (var i = filters.Length - 2; i >= 0; i--)
            {
                current = new FilterPipe <TOutput>(filters[i], current);
            }

            return(current);
        }
Exemplo n.º 2
0
        public IPipe <TContext> Build()
        {
            if (_filters.Count == 0)
            {
                return(Pipe.Empty <TContext>());
            }

            IPipe <TContext> current = new LastPipe <TContext>(_filters[_filters.Count - 1]);

            for (var i = _filters.Count - 2; i >= 0; i--)
            {
                current = new FilterPipe <TContext>(_filters[i], current);
            }

            return(current);
        }
Exemplo n.º 3
0
        static IPipe <ConsumeContext <TMessage> > BuildOutputPipe(IFilter <ConsumeContext <TMessage> >[] filters)
        {
            if (filters.Length == 0)
            {
                throw new ArgumentException("There must be at least one filter, the output filter, for the output pipe");
            }

            IPipe <ConsumeContext <TMessage> > current = new LastPipe <ConsumeContext <TMessage> >(filters[filters.Length - 1]);

            for (int i = filters.Length - 2; i >= 0; i--)
            {
                current = new FilterPipe <ConsumeContext <TMessage> >(filters[i], current);
            }

            return(current);
        }