Пример #1
0
        protected virtual void BuildIndexedTree(IList <IPath> paths,
                                                Dictionary <IPath, List <IPathSegment> > indexedPathSegments,
                                                IndexedPathSegmentTreeNode <string> rootIndexedValueTreeNode)
        {
            foreach (IPath path in paths)
            {
                IndexedPathSegmentTreeNode <string> IndexedPathSegmentTreeNode = rootIndexedValueTreeNode;
                int pathSegmentCount = 0;

                while (pathSegmentCount < indexedPathSegments[path].Count)
                {
                    IndexedPathSegmentTreeNode <string> tmpIndexedPathSegmentTreeNode;
                    IPathSegment pathSegment = indexedPathSegments[path][pathSegmentCount];
                    if (
                        !IndexedPathSegmentTreeNode.TryGetValue(pathSegment.ActualSegment,
                                                                out tmpIndexedPathSegmentTreeNode))
                    {
                        IndexedPathSegmentTreeNode <string> newIndexedPathSegmentTreeNode =
                            CreatePathSegmentIndexedPathSegmentTreeNode(pathSegment, IndexedPathSegmentTreeNode);
                        IndexedPathSegmentTreeNode.Add(pathSegment.ActualSegment, newIndexedPathSegmentTreeNode);
                        IndexedPathSegmentTreeNode = newIndexedPathSegmentTreeNode;
                    }
                    else
                    {
                        IndexedPathSegmentTreeNode = tmpIndexedPathSegmentTreeNode;
                    }

                    pathSegmentCount++;
                }
            }
        }
Пример #2
0
        protected override void BuildIndexedTree(IList <IPath> paths,
                                                 Dictionary <IPath, List <IPathSegment> > indexedPathSegments,
                                                 IndexedPathSegmentTreeNode <string> rootIndexedValueTreeNode)
        {
            foreach (IPath path in paths)
            {
                IndexedPathSegmentTreeNode <string> indexedPathSegmentTreeNode = rootIndexedValueTreeNode;
                int pathSegmentCount = 0;

                while (pathSegmentCount < indexedPathSegments[path].Count)
                {
                    IndexedPathSegmentTreeNode <string> tmpIndexedPathSegmentTreeNode = null;
                    var            pathSegment = indexedPathSegments[path][pathSegmentCount] as XmlPathSegment;
                    XmlPathSegment parentPathSegment;

                    if (pathSegmentCount > 0)
                    {
                        parentPathSegment = indexedPathSegments[path][pathSegmentCount - 1] as XmlPathSegment;
                    }
                    else
                    {
                        parentPathSegment = null;
                    }

                    if (indexedPathSegmentTreeNode != null &&
                        (pathSegment != null &&
                         !indexedPathSegmentTreeNode.TryGetValue(pathSegment.ActualSegment,
                                                                 out tmpIndexedPathSegmentTreeNode)))
                    {
                        IndexedPathSegmentTreeNode <string> newIndexedPathSegmentTreeNode =
                            CreatePathSegmentIndexedPathSegmentTreeNode(pathSegment, parentPathSegment,
                                                                        indexedPathSegmentTreeNode);
                        indexedPathSegmentTreeNode.Add(pathSegment.ActualSegment, newIndexedPathSegmentTreeNode);
                        indexedPathSegmentTreeNode = newIndexedPathSegmentTreeNode;
                    }
                    else
                    {
                        indexedPathSegmentTreeNode = tmpIndexedPathSegmentTreeNode;
                    }

                    pathSegmentCount++;
                }
            }
        }