protected void AddChildInternal(CallPattern callPattern, int depth, MatcherTreeNode leaf) { if (depth == callPattern.ArgumentMatchers.Count+1) { this.Children.Add(leaf); leaf.Parent = this; return; } var matcher = depth == 0 ? callPattern.InstanceMatcher : callPattern.ArgumentMatchers[depth - 1]; var found = this.GetMatchingChild(matcher, MatchingOptions.Exact, depth); if (found != null) { found.AddChildInternal(callPattern, depth+1, leaf); } else { var node = new MatcherTreeNode(matcher); Children.Add(node); node.Parent = this; node.AddChildInternal(callPattern, depth+1, leaf); } }
protected void AddChildInternal(CallPattern callPattern, int depth, MatcherTreeNode leaf) { if (depth == callPattern.ArgumentMatchers.Count + 1) { this.Children.Add(leaf); leaf.Parent = this; return; } var matcher = depth == 0 ? callPattern.InstanceMatcher : callPattern.ArgumentMatchers[depth - 1]; var found = this.GetMatchingChild(matcher, MatchingOptions.Exact, depth); if (found != null) { found.AddChildInternal(callPattern, depth + 1, leaf); } else { var node = new MatcherTreeNode(matcher); Children.Add(node); node.Parent = this; node.AddChildInternal(callPattern, depth + 1, leaf); } }