예제 #1
0
        /// <summary>
        /// Returns a future that indicates whether all values
        /// yielded by the data-producer satisfy a given condition.
        /// The future will return true for an empty sequence or
        /// where all values satisfy the condition, else false
        /// (if any value value fails to satisfy the condition).
        /// </summary>
        /// <param name="source">The data-producer to be monitored.</param>
        /// <param name="predicate">The condition that must be satisfied by all terms.</param>
        public static IFuture <bool> All <TSource>(this IDataProducer <TSource> source, DotNet20.Func <TSource, bool> predicate)
        {
            predicate.ThrowIfNull("predicate");

            return(FutureProxy <bool> .FromFuture(source.Any(value => !predicate(value)), value => !value));
        }