Esempio n. 1
0
        private void IncrementalRecalculateBasisNode(int index, DocumentNodeChangeList damage, uint documentChangeStamp)
        {
            SceneNodeSubscription <basisT, pathT> .BasisNodeHolder basisNodeHolder = this.basisNodeList.ValueAt(index);
            DocumentNodeMarker ancestor = this.basisNodeList.MarkerAt(index);

            if ((int)basisNodeHolder.lastRecalcChangeStamp == (int)documentChangeStamp)
            {
                return;
            }
            SceneNodeSubscription <basisT, pathT> .BasisNodeInfo basisNodeInfo = this.BasisNodeAt(index);
            if (damage.Count == 0)
            {
                this.RecalculateBasisNode(index);
            }
            foreach (int index1 in damage.FindDescendants(ancestor))
            {
                DocumentNodeMarker documentNodeMarker = damage.MarkerAt(index1);
                if (documentNodeMarker.IsDeleted)
                {
                    this.RemovePathNodes(basisNodeInfo, documentNodeMarker);
                    basisNodeHolder.PathNodeList.RemoveSelfAndDescendants(documentNodeMarker);
                }
                else
                {
                    foreach (SceneNode sceneNode in this.IncrementalTraverseWithSearchPath(basisNodeHolder.Node, documentNodeMarker))
                    {
                        this.AddPathNode(basisNodeInfo, sceneNode.DocumentNode.Marker);
                        basisNodeHolder.PathNodeList.Add(sceneNode.DocumentNode.Marker);
                    }
                }
            }
            basisNodeHolder.lastRecalcChangeStamp = documentChangeStamp;
        }
Esempio n. 2
0
        public void ChainUpdate(SceneViewModel viewModel, DocumentNodeMarkerSortedListBase newBasisNodes, IEnumerable <SceneNode> bonusBasisNodes, DocumentNodeChangeList damage, uint damageChangeStamp)
        {
            this.ValidateBasisNodeStateWithViewModel(viewModel);
            if (this.currentViewModel == null)
            {
                return;
            }
            SearchScope searchScope = (SearchScope)6;
            SearchScope scope       = this.path.Scope;
            bool        flag1       = (scope & searchScope) != scope;
            bool        flag2       = false;

            if (this.path.NumberOfSteps == 1)
            {
                SearchStep searchStep = this.path.Step(0);
                if (searchStep.Axis == SearchAxis.DocumentDescendant && (searchStep.Predicate.AnalysisScope & (SearchScope)6) == searchStep.Predicate.AnalysisScope)
                {
                    flag2 = true;
                }
            }
            if (newBasisNodes != null || bonusBasisNodes != null)
            {
                DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder> newBasisNodeList = new DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder>(newBasisNodes.Count);
                if (newBasisNodes != null)
                {
                    for (int index = 0; index < newBasisNodes.Count; ++index)
                    {
                        newBasisNodeList.Add(newBasisNodes.MarkerAt(index), (SceneNodeSubscription <basisT, pathT> .BasisNodeHolder)null);
                    }
                }
                if (bonusBasisNodes != null)
                {
                    foreach (SceneNode sceneNode in bonusBasisNodes)
                    {
                        newBasisNodeList.Add(sceneNode.DocumentNode.Marker, (SceneNodeSubscription <basisT, pathT> .BasisNodeHolder)null);
                    }
                }
                this.SetBasisNodesWorker(viewModel, newBasisNodeList);
            }
            foreach (DocumentNodeMarkerSortedListBase.IntersectionResult intersectionResult in this.pathNodeList.Intersect((DocumentNodeMarkerSortedListBase)damage, DocumentNodeMarkerSortedListBase.Flags.Contains))
            {
                this.OnPathNodeContentChanged(this.pathNodeList.ValueAt(intersectionResult.LeftHandSideIndex), damage.MarkerAt(intersectionResult.RightHandSideIndex), damage.ValueAt(intersectionResult.RightHandSideIndex));
            }
            if (flag1)
            {
                this.Recalculate(viewModel);
            }
            else
            {
                for (int index = this.basisNodeList.Count - 1; index >= 0; --index)
                {
                    if (this.basisNodeList.MarkerAt(index).IsDeleted)
                    {
                        this.RemoveBasisNode(index);
                    }
                    else if (flag2)
                    {
                        this.IncrementalRecalculateBasisNode(index, damage, damageChangeStamp);
                    }
                    else
                    {
                        this.RecalculateBasisNode(index);
                    }
                }
            }
        }