Exemplo n.º 1
0
            IDictionary <ChangedDescendantInfo <TNode>, IEnumerable <TNode> > desChangedRange()
            {
                //祖先宛の子孫変更通知
                //同一ツリー内での移動
                var dic  = new Dictionary <ChangedDescendantInfo <TNode>, IEnumerable <TNode> >();
                var dArg = new ChangedDescendantInfo <TNode>(TreeNodeChangedAction.Deviate, _self, OldParent, oldIndex);
                var jArg = new ChangedDescendantInfo <TNode>(TreeNodeChangedAction.Join, _self, OldParent, oldIndex);

                if (object.Equals(PreOldRoot, _self.Upstream().Last()))
                {
                    var mArg    = new ChangedDescendantInfo <TNode>(TreeNodeChangedAction.Move, _self, OldParent, oldIndex);
                    var deviate = preOldAnc.Except(_self.Upstream().Skip(1));
                    var join    = _self.Upstream().Skip(1).Except(preOldAnc);
                    var move    = preOldAnc.Intersect(_self.Upstream().Skip(1));
                    if (deviate.Any())
                    {
                        dic.Add(dArg, deviate);
                    }
                    if (join.Any())
                    {
                        dic.Add(jArg, join);
                    }
                    if (move.Any())
                    {
                        dic.Add(mArg, move);
                    }
                }
                else
                {
                    if (OldParent != null)
                    {
                        dic.Add(dArg, OldParent.Upstream());
                    }
                    if (NewParent != null)
                    {
                        dic.Add(jArg, NewParent.Upstream());
                    }
                }
                return(dic);
            }