Esempio n. 1
0
 public INotifyEnumerable <TResult> AsNotifiable()
 {
     if (notifyEnumerable == null)
     {
         var innerExpression        = Inner as IEnumerableExpression <TInner>;
         IEnumerable <TInner> inner = Inner;
         if (innerExpression != null)
         {
             inner = innerExpression.AsNotifiable();
         }
         notifyEnumerable = Source.AsNotifiable().Join(inner, OuterKeySelector, InnerKeySelector, ResultSelector, Comparer);
     }
     return(notifyEnumerable);
 }
Esempio n. 2
0
        public ObservableSelect(INotifyEnumerable <TSource> source, ObservingFunc <TSource, TResult> lambda)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (lambda == null)
            {
                throw new ArgumentNullException("lambda");
            }

            this.source = source;
            this.lambda = lambda;
        }
Esempio n. 3
0
        public ObservableWhere(INotifyEnumerable <T> source, ObservingFunc <T, bool> lambda)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (lambda == null)
            {
                throw new ArgumentNullException("lambda");
            }

            this.source = source;
            this.lambda = lambda;
        }
Esempio n. 4
0
        public ObservableSimpleSelectMany(INotifyEnumerable <TSource> source,
                                          ObservingFunc <TSource, IEnumerable <TResult> > selector)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            this.source   = source;
            this.selector = selector;
        }
Esempio n. 5
0
        public ObservableConcat(INotifyEnumerable <TSource> source, IEnumerable <TSource> source2)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (source2 == null)
            {
                throw new ArgumentNullException("source2");
            }

            this.source  = source;
            this.source2 = source2;

            Attach();
        }
Esempio n. 6
0
        public ObservableOrderBy(INotifyEnumerable <TItem> source, ObservingFunc <TItem, TKey> keySelector, IComparer <TKey> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (keySelector == null)
            {
                throw new ArgumentNullException("keySelector");
            }

            this.source      = source;
            this.keySelector = keySelector;

            this.searchTree = new SortedDictionary <TKey, Collection <TItem> >(comparer);
        }
Esempio n. 7
0
        public ObservableGroupBy(INotifyEnumerable <TItem> source, ObservingFunc <TItem, TKey> keySelector, IEqualityComparer <TKey> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (keySelector == null)
            {
                throw new ArgumentNullException("keySelector");
            }

            this.groups = new Dictionary <TKey, ObservableGroup <TKey, TItem> >(comparer);

            this.source      = source;
            this.keySelector = keySelector;
        }
Esempio n. 8
0
        public ObservableExcept(INotifyEnumerable <TSource> source, IEnumerable <TSource> source2, IEqualityComparer <TSource> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (source2 == null)
            {
                throw new ArgumentNullException("source2");
            }

            this.source  = source;
            this.source2 = source2;
            sourceItems  = new Dictionary <TSource, int>(comparer);

            Attach();
        }
Esempio n. 9
0
        public ObservableConcat(INotifyEnumerable <TSource> source, IEnumerable <TSource> source2)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (source2 == null)
            {
                throw new ArgumentNullException("source2");
            }

            this.source            = source;
            this.source2           = source2;
            this.observableSource2 = source2 as INotifyEnumerable <TSource>;
            if (observableSource2 == null)
            {
                observableSource2 = (source2 as IEnumerableExpression <TSource>)?.AsNotifiable();
            }
        }
Esempio n. 10
0
        public ObservableOrderBy(INotifyEnumerable <TItem> source, ObservingFunc <TItem, TKey> keySelector, IComparer <TKey> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (keySelector == null)
            {
                throw new ArgumentNullException("keySelector");
            }

            this.source      = source;
            this.keySelector = keySelector;

            this.searchTree           = new SortedDictionary <TKey, ObservableCollection <TItem> >(comparer);
            this.manualRaiseSequences = new ManualObservableCollectionView <IEnumerable <TItem> >(searchTree.Values);

            Attach();
        }
Esempio n. 11
0
        public ObservableIntersect(INotifyEnumerable <TSource> source, IEnumerable <TSource> source2, IEqualityComparer <TSource> comparer)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (source2 == null)
            {
                throw new ArgumentNullException("source2");
            }

            this.source            = source;
            this.source2           = source2;
            this.observableSource2 = source2 as INotifyEnumerable <TSource>;
            if (observableSource2 == null)
            {
                observableSource2 = (source2 as IEnumerableExpression <TSource>)?.AsNotifiable();
            }
            sourceItems = new Dictionary <TSource, int>(comparer);
        }
Esempio n. 12
0
        protected ObservableSetComparer(INotifyEnumerable <T> source1, IEnumerable <T> source2, IEqualityComparer <T> comparer)
        {
            if (source1 == null)
            {
                throw new ArgumentNullException("source1");
            }
            if (source2 == null)
            {
                throw new ArgumentNullException("source2");
            }

            this.source1 = source1;
            this.source2 = source2;

            if (source1 != source2)
            {
                this.entries = new Dictionary <T, Entry>(comparer);
            }

            Attach();
        }
Esempio n. 13
0
        public ObservableSelectMany(INotifyEnumerable <TSource> source,
                                    ObservingFunc <TSource, IEnumerable <TIntermediate> > func,
                                    ObservingFunc <TSource, TIntermediate, TResult> selector)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (func == null)
            {
                throw new ArgumentNullException("func");
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            this.source   = source;
            this.func     = func;
            this.selector = selector;
        }
Esempio n. 14
0
 protected void AttachCore()
 {
     if (childrenCollection == null)
     {
         childrenCollection = Element.Children.AsNotifiable();
     }
     else
     {
         childrenCollection.Attach();
     }
     childrenCollection.CollectionChanged += ChildrenChanged;
     if (childCollections == null)
     {
         childCollections = new Dictionary <IModelElement, INotifyEnumerable <IModelElement> >();
     }
     foreach (var child in childrenCollection)
     {
         var descendants = child.Descendants().AsNotifiable();
         descendants.CollectionChanged += PropagateChildChanges;
         childCollections.Add(child, descendants);
     }
 }
Esempio n. 15
0
 private void AddElements(IEnumerableExpression <T> elements)
 {
     if (elements != null)
     {
         if (Incremental)
         {
             var incElements = elements.AsNotifiable();
             foreach (var node in incElements)
             {
                 GetOrCreate(node, true);
             }
             incElements.CollectionChanged += RootElementsChanged;
             this.incElements = incElements;
         }
         else
         {
             foreach (var node in elements)
             {
                 GetOrCreate(node, true);
             }
         }
     }
 }
Esempio n. 16
0
        protected ObservableSetComparer(INotifyEnumerable <T> source1, IEnumerable <T> source2, IEqualityComparer <T> comparer)
        {
            if (source1 == null)
            {
                throw new ArgumentNullException("source1");
            }
            if (source2 == null)
            {
                throw new ArgumentNullException("source2");
            }

            this.source1 = source1;
            this.source2 = source2;

            this.observableSource2 = source2 as INotifyEnumerable <T>;
            if (observableSource2 == null)
            {
                observableSource2 = (source2 as IEnumerableExpression <T>)?.AsNotifiable();
            }
            this.entries = new Dictionary <T, Entry>(comparer);

            Successors.Attached += (obj, e) => Attach();
            Successors.Detached += (obj, e) => Detach();
        }
Esempio n. 17
0
        public ObservableGroupJoin(INotifyEnumerable <TOuter> outerSource, IEnumerable <TInner> innerSource, ObservingFunc <TOuter, TKey> outerKeySelector, ObservingFunc <TInner, TKey> innerKeySelector, ObservingFunc <TOuter, IEnumerable <TInner>, TResult> resultSelector, IEqualityComparer <TKey> comparer)
        {
            if (outerSource == null)
            {
                throw new ArgumentNullException("outerSource");
            }
            if (innerSource == null)
            {
                throw new ArgumentNullException("innerSource");
            }
            if (outerKeySelector == null)
            {
                throw new ArgumentNullException("outerKeySelector");
            }
            if (innerKeySelector == null)
            {
                throw new ArgumentNullException("innerKeySelector");
            }
            if (resultSelector == null)
            {
                throw new ArgumentNullException("resultSelector");
            }

            this.outerSource      = outerSource;
            this.innerSource      = innerSource;
            this.outerKeySelector = outerKeySelector;
            this.innerKeySelector = innerKeySelector;
            this.resultSelector   = resultSelector;

            this.observableInnerSource = innerSource as INotifyEnumerable <TInner>;
            if (observableInnerSource == null)
            {
                observableInnerSource = (innerSource as IEnumerableExpression <TInner>)?.AsNotifiable();
            }
            groups = new Dictionary <TKey, KeyGroup>(comparer);
        }
Esempio n. 18
0
 public ObservableLambdaAny(INotifyEnumerable <TSource> source, Expression <Func <TSource, bool> > selector)
     : base(new ObservableSelect <TSource, bool>(source, selector), 0)
 {
 }
Esempio n. 19
0
 public static ObservableLambdaAny <TSource> Create(INotifyEnumerable <TSource> source, Expression <Func <TSource, bool> > selector)
 {
     return(new ObservableLambdaAny <TSource>(source, selector));
 }
Esempio n. 20
0
 public ObservableAny(INotifyEnumerable <TSource> source)
     : base(source, 0)
 {
 }
Esempio n. 21
0
 public static ObservableAny <TSource> Create(INotifyEnumerable <TSource> source)
 {
     return(new ObservableAny <TSource>(source));
 }
Esempio n. 22
0
 public static ObservableSingleOrDefault <TSource> CreateForPredicate(INotifyEnumerable <TSource> source, Expression <Func <TSource, bool> > predicate)
 {
     return(new ObservableSingleOrDefault <TSource>(source.Where(predicate)));
 }
Esempio n. 23
0
 public static ObservableSingleOrDefault <TSource> Create(INotifyEnumerable <TSource> source)
 {
     return(new ObservableSingleOrDefault <TSource>(source));
 }
Esempio n. 24
0
 public static INotifyValue <long> SumLambdaLong <TSource>(INotifyEnumerable <TSource> source, Expression <Func <TSource, long> > selector)
 {
     return(SumLong(source.Select(selector)));
 }
Esempio n. 25
0
 public static INotifyValue <int> SumLambdaInt <TSource>(INotifyEnumerable <TSource> source, Expression <Func <TSource, int> > selector)
 {
     return(SumInt(source.Select(selector)));
 }
Esempio n. 26
0
 public ObservableNullableDecimalSum(INotifyEnumerable <decimal?> source)
     : base(source, new SumData <decimal>())
 {
 }
Esempio n. 27
0
 public ObservableNullableDoubleSum(INotifyEnumerable <double?> source)
     : base(source, new SumData <double>())
 {
 }
Esempio n. 28
0
 public ObservableNullableFloatSum(INotifyEnumerable <float?> source)
     : base(source, new SumData <float>())
 {
 }
Esempio n. 29
0
 public Notifiable(CustomCollection <T> parent, INotifyEnumerable <T> inner)
 {
     Parent = parent;
     Inner  = inner;
 }
Esempio n. 30
0
 public ObservableNullableLongSum(INotifyEnumerable <long?> source)
     : base(source, new SumData <long>())
 {
 }