/// <summary>
 /// Creates a new quoted representation of a subscribable sequence.
 /// </summary>
 /// <param name="value">Subscribable sequence to create a quote for.</param>
 /// <param name="expression">Expression representing the subscribable sequence.</param>
 /// <param name="policy">Policy used to evaluate the expression.</param>
 public QuotedSubscribable(ISubscribable <T> value, Expression expression, IExpressionEvaluationPolicy policy)
     : base(value, expression, policy)
 {
     //
     // WARNING: This constructor gets called during quote instantiation.
     //
 }
Example #2
0
 public ListenerJanitor(ISubscribable <T> subscribable, T subscriber)
 {
     UnityEngine.Debug.Assert(subscribable != null, "Subscribable is null");
     UnityEngine.Debug.Assert(subscriber != null, "Subscriber is null");
     this.subscribable = subscribable;
     this.subscriber   = subscriber;
 }
Example #3
0
        public Skip(ISubscribable <TSource> source, int skipCount)
        {
            Debug.Assert(source != null);

            _source    = source;
            _skipCount = skipCount;
        }
Example #4
0
        public DefaultIfEmpty(ISubscribable <TSource> source, TSource defaultValue = default)
        {
            Debug.Assert(source != null);

            _source       = source;
            _defaultValue = defaultValue;
        }
        public virtual PartialViewResult Index(ISubscribable subscribe, Guid activityId)
        {
            var userId     = _intranetMemberService.GetCurrentMemberId();
            var subscriber = subscribe.Subscribers.SingleOrDefault(s => s.UserId == userId);

            return(Index(activityId, subscriber, subscribe.Type));
        }
Example #6
0
        public StartWith(ISubscribable <T> source, params T[] values)
        {
            Debug.Assert(source != null);

            _source = source;
            _values = values;
        }
Example #7
0
 public void AddSubscription(ISubscribable subscribable)
 {
     lock (this._subscriptions)
     {
         this._subscriptions.Add(subscribable);
     }
 }
 public BlockDoSubscribable(ISubscribable <T> source, string onNextLockName, string onErrorLockName, string onCompletedLockName)
 {
     _source              = source;
     _onNextLockName      = onNextLockName;
     _onErrorLockName     = onErrorLockName;
     _onCompletedLockName = onCompletedLockName;
 }
Example #9
0
 public void RemoveSubscription(ISubscribable subscribable)
 {
     lock (this._subscriptions)
     {
         this._subscriptions.Remove(subscribable);
     }
 }
Example #10
0
            public void OnNext(ISubscribable <TSource> source)
            {
                var id = default(ulong);

                lock (_lock)
                {
                    id         = unchecked (++_latest);
                    _hasLatest = true;
                }

                try
                {
                    var observer = new i(this, id);

                    var subscription = SubscribeInner <TSource>(source, observer);
                    observer.Subscription = subscription;

                    SubscriptionInitializeVisitor.Subscribe(subscription);
                    SubscriptionInitializeVisitor.SetContext(subscription, _context);

                    _innerSubscription.Subscription = subscription;

                    SubscriptionInitializeVisitor.Start(subscription);
                }
                catch (Exception ex)
                {
                    lock (_lock)
                    {
                        Output.OnError(ex);
                        Dispose();
                    }
                }
            }
Example #11
0
        public static ListenerJanitor <T> NewAndActivate(ISubscribable <T> subscribable, T subscriber)
        {
            ListenerJanitor <T> okd = new ListenerJanitor <T>(subscribable, subscriber);

            okd.Active = true;
            return(okd);
        }
Example #12
0
 public SelectMany(ISubscribable <TSource> source,
                   Func <TSource, ISubscribable <TCollection> > collectionSelector,
                   Func <TSource, TCollection, TResult> resultSelector)
 {
     _source             = source;
     _collectionSelector = collectionSelector;
     _resultSelector     = resultSelector;
 }
Example #13
0
        public SingleAsync(ISubscribable <TSource> source, Func <TSource, bool> predicate, bool throwOnEmpty)
        {
            Debug.Assert(source != null);

            _source       = source;
            _predicate    = predicate ?? (_ => true);
            _throwOnEmpty = throwOnEmpty;
        }
Example #14
0
        public Sample(ISubscribable <TSource> source, ISubscribable <TSample> sampler)
        {
            Debug.Assert(source != null);
            Debug.Assert(sampler != null);

            _source  = source;
            _sampler = sampler;
        }
Example #15
0
        public Take(ISubscribable <TResult> source, int count)
        {
            Debug.Assert(source != null);
            Debug.Assert(count > 0);

            _source = source;
            _count  = count;
        }
Example #16
0
        public TakeWhileIndexed(ISubscribable <TSource> source, Func <TSource, int, bool> indexPredicate)
        {
            Debug.Assert(source != null);
            Debug.Assert(indexPredicate != null);

            _source         = source;
            _indexPredicate = indexPredicate;
        }
Example #17
0
        public TakeWhile(ISubscribable <TSource> source, Func <TSource, bool> predicate)
        {
            Debug.Assert(source != null);
            Debug.Assert(predicate != null);

            _source    = source;
            _predicate = predicate;
        }
Example #18
0
        public WhereIndexed(ISubscribable <TResult> source, Func <TResult, int, bool> indexPredicate)
        {
            Debug.Assert(source != null);
            Debug.Assert(indexPredicate != null);

            _source         = source;
            _indexPredicate = indexPredicate;
        }
Example #19
0
        public Where(ISubscribable <TResult> source, Func <TResult, bool> predicate)
        {
            Debug.Assert(source != null);
            Debug.Assert(predicate != null);

            _source    = source;
            _predicate = predicate;
        }
Example #20
0
        public TakeUntil(ISubscribable <TSource> source, ISubscribable <TOther> other)
        {
            Debug.Assert(source != null);
            Debug.Assert(other != null);

            _source = source;
            _other  = other;
        }
Example #21
0
        public SelectIndexed(ISubscribable <TSource> source, Func <TSource, int, TResult> selector)
        {
            Debug.Assert(source != null);
            Debug.Assert(selector != null);

            _source        = source;
            _indexSelector = selector;
        }
Example #22
0
        protected DelegateSubscription(TDelegate delegateToExecute, ISubscribable <TArg1, TArg2> attachedProvider) : base(attachedProvider)
        {
            if (delegateToExecute == null)
            {
                throw new ArgumentNullException(nameof(delegateToExecute));
            }

            this.delegateToExecute = delegateToExecute;
        }
Example #23
0
        public void Unsubscribe(ISubscribable subscribable)
        {
            if (!_listeners.Contains(subscribable))
            {
                throw new InvalidOperationException();
            }

            _listeners.Remove(subscribable);
        }
Example #24
0
        /// <summary>
        /// Subscription cleanup operator. This operator should only be injected in the final position before a Subscribe call
        /// in order to defer cleanup until completion of the entire query.
        /// </summary>
        /// <typeparam name="T">Type of the elements processed by the operator.</typeparam>
        /// <param name="source">Sequence to provide subscription cleanup for.</param>
        /// <returns>Sequence with the subscription cleanup operator applied.</returns>
        public static ISubscribable <T> CleanupSubscription <T>(this ISubscribable <T> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(new SubscriptionCleanup <T>(source));
        }
Example #25
0
        public SkipUntil(ISubscribable <TSource> source, ISubscribable <TOther> other, bool terminateEarly = false)
        {
            Debug.Assert(source != null);
            Debug.Assert(other != null);

            _source         = source;
            _other          = other;
            _terminateEarly = terminateEarly;
        }
Example #26
0
        public static ISubscribable <Decimal> Sum(this ISubscribable <Decimal> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(new SumDecimal(source));
        }
Example #27
0
        public static ISubscribable <Double?> Sum(this ISubscribable <Double?> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(new SumNullableDouble(source));
        }
Example #28
0
        public static ISubscribable <TSource> SubscribeOnInternalScheduler <TSource>(this ISubscribable <TSource> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(new SubscribableOnScheduler <TSource>(source));
        }
        public static IPartitionableSubscribable <T> ToPartitionableSubscribable <T>(this ISubscribable <T> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(new SimplePartitionableSubscribable <T>(source));
        }
Example #30
0
        public static ISubscribable <Int32> Sum(this ISubscribable <Int32> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(new SumInt32(source));
        }
Example #31
0
 public void Subscribe(ISubscribable entity)
 {
     createEntities.Enqueue(entity);
     entity.SubscribedBy.Add(Session);
 }
Example #32
0
 public void UnSubscribe(ISubscribable entity)
 {
     updateEntities.Remove(entity);
     removeEntities.Enqueue(entity);
     entity.SubscribedBy.Remove(Session);
 }