public override void Verify()
 {
     base.Verify();
     Debug.Assert(Subordinate != null);
     Debug.Assert(Subordinate.ExistsInVersion(OldVersion));
     Debug.Assert(Subordinate.GetInVersion(NewVersion) == Subordinate);
     Debug.Assert(NewParent.Components.Contains(Subordinate));
     Debug.Assert(OldParent.Components.Contains(SubordinateOldVersion));
     Debug.Assert(NewParent != OldParent);
     Debug.Assert(NewParent.GetInVersion(OldVersion) != OldParent);
 }
示例#2
0
 public override void Verify()
 {
     base.Verify();
     Debug.Assert(ClassUnion != null);
     Debug.Assert(ClassUnion.ExistsInVersion(OldVersion));
     Debug.Assert(ClassUnion.GetInVersion(NewVersion) == ClassUnion);
     Debug.Assert(NewParent.Child == ClassUnion);
     Debug.Assert(OldParent.Child == ClassUnionOldVersion);
     Debug.Assert(NewParent != OldParent);
     Debug.Assert(NewParent.GetInVersion(OldVersion) != OldParent);
 }
示例#3
0
            IDictionary <StructureChangedEventArgs <TNode>, IEnumerable <TNode> > strChangeRange()
            {
                var nr = _self.Upstream().Last();
                Dictionary <StructureChangedEventArgs <TNode>, IEnumerable <TNode> > dic = new Dictionary <StructureChangedEventArgs <TNode>, IEnumerable <TNode> >();
                var dArg = new StructureChangedEventArgs <TNode>(TreeNodeChangedAction.Deviate, _self, OldParent, oldIndex);
                var jArg = new StructureChangedEventArgs <TNode>(TreeNodeChangedAction.Join, _self, OldParent, oldIndex);

                if (object.Equals(PreOldRoot, nr))
                {
                    var mArg = new StructureChangedEventArgs <TNode>(TreeNodeChangedAction.Move, _self, OldParent, oldIndex);
                    if (NewParent != null && OldParent != null && OldParent.Root() != PreOldRoot)
                    {
                        dic.Add(dArg, OldParent.Root().Levelorder());  //remove
                    }
                    dic.Add(mArg, nr.Levelorder());                    //move
                }
                else
                {
                    //add or remove
                    if (OldParent != null)
                    {
                        dic.Add(dArg, OldParent.Root().Levelorder());
                    }
                    if (NewParent != null)
                    {
                        dic.Add(jArg, NewParent.Root().Levelorder());
                    }
                    else
                    {
                        IEnumerable <TNode> v;
                        if (dic.TryGetValue(dArg, out v))
                        {
                            dic[dArg] = v.Union(_self.Levelorder());
                        }
                        else
                        {
                            dic.Add(dArg, _self.Levelorder());
                        }
                    }
                }
                return(dic);
            }
示例#4
0
 override protected void WriteToXmlElement(XmlElement iElement)
 {
     base.WriteToXmlElement(iElement);
     if (Status != EntityType.Unknown)
     {
         iElement.SetAttribute("type", Status.ToString());
     }
     if (NewParent != 0)
     {
         iElement.SetAttribute("parent", NewParent.ToString());
     }
     if (!String.IsNullOrEmpty(Name))
     {
         iElement.SetAttribute("name", Name);
     }
     if (!String.IsNullOrEmpty(English))
     {
         iElement.SetAttribute("name", English);
     }
 }
示例#5
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);
            }
示例#6
0
 protected internal override void Undo()
 {
     NewParent.InternalReplaceItemRange(NewIndex, 1, new PlaylistItem[] { });
     OldParent.InternalReplaceItemRange(OldIndex, 0, new PlaylistItem[] { Item });
 }