private SegmentHierarchyNode <TItem> FindOrCreateNode(BaseUriWithWildcard baseUri) { string[] strArray = UriSegmenter <TItem> .ToPath(baseUri.BaseAddress, baseUri.HostNameComparisonMode, this.includePortInComparison); SegmentHierarchyNode <TItem> root = this.root; for (int i = 0; i < strArray.Length; i++) { SegmentHierarchyNode <TItem> node2; if (!root.TryGetChild(strArray[i], out node2)) { node2 = new SegmentHierarchyNode <TItem>(strArray[i], this.useWeakReferences); root.SetChildNode(strArray[i], node2); } root = node2; } return(root); }
SegmentHierarchyNode <TItem> FindOrCreateNode(BaseUriWithWildcard baseUri) { Fx.Assert(baseUri != null, "FindOrCreateNode: baseUri is null"); string[] path = UriSegmenter.ToPath(baseUri.BaseAddress, baseUri.HostNameComparisonMode, this.includePortInComparison); SegmentHierarchyNode <TItem> current = this.root; for (int i = 0; i < path.Length; ++i) { SegmentHierarchyNode <TItem> next; if (!current.TryGetChild(path[i], out next)) { next = new SegmentHierarchyNode <TItem>(path[i], useWeakReferences); current.SetChildNode(path[i], next); } current = next; } return(current); }
private SegmentHierarchyNode <TItem> FindDataNode(string[] path, out bool exactMatch) { exactMatch = false; SegmentHierarchyNode <TItem> root = this.root; SegmentHierarchyNode <TItem> node2 = null; for (int i = 0; i < path.Length; i++) { SegmentHierarchyNode <TItem> node3; if (!root.TryGetChild(path[i], out node3)) { return(node2); } if (node3.Data != null) { node2 = node3; exactMatch = i == (path.Length - 1); } root = node3; } return(node2); }
SegmentHierarchyNode <TItem> FindDataNode(string[] path, out bool exactMatch) { Fx.Assert(path != null, "FindDataNode: path is null"); exactMatch = false; SegmentHierarchyNode <TItem> current = this.root; SegmentHierarchyNode <TItem> result = null; for (int i = 0; i < path.Length; ++i) { SegmentHierarchyNode <TItem> next; if (!current.TryGetChild(path[i], out next)) { break; } else if (next.Data != null) { result = next; exactMatch = (i == path.Length - 1); } current = next; } return(result); }