// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System.Collections.Generic; using System.Reactive.Disposables; using System.Reactive.Joins; namespace System.Reactive.Linq { public static partial class Observable { #region And /// /// Creates a pattern that matches when both observable sequences have an available element. /// /// The type of the elements in the left sequence. /// The type of the elements in the right sequence. /// Observable sequence to match with the right sequence. /// Observable sequence to match with the left sequence. /// Pattern object that matches when both observable sequences have an available element. /// or is null. public static Pattern And(this IObservable left, IObservable right) { if (left == null) throw new ArgumentNullException("left"); if (right == null) throw new ArgumentNullException("right"); return s_impl.And(left, right); } #endregion #region Then /// /// Matches when the observable sequence has an available element and projects the element by invoking the selector function. /// /// The type of the elements in the source sequence. /// The type of the elements in the result sequence, returned by the selector function. /// Observable sequence to apply the selector on. /// Selector that will be invoked for elements in the source sequence. /// Plan that produces the projected results, to be fed (with other plans) to the When operator. /// or is null. public static Plan Then(this IObservable source, Func selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return s_impl.Then(source, selector); } #endregion #region When /// /// Joins together the results from several patterns. /// /// The type of the elements in the result sequence, obtained from the specified patterns. /// A series of plans created by use of the Then operator on patterns. /// An observable sequence with the results from matching several patterns. /// is null. public static IObservable When(params Plan[] plans) { if (plans == null) throw new ArgumentNullException("plans"); return s_impl.When(plans); } /// /// Joins together the results from several patterns. /// /// The type of the elements in the result sequence, obtained from the specified patterns. /// A series of plans created by use of the Then operator on patterns. /// An observable sequence with the results form matching several patterns. /// is null. public static IObservable When(this IEnumerable> plans) { if (plans == null) throw new ArgumentNullException("plans"); return s_impl.When(plans); } #endregion } }