Castle.MicroKernel.SubSystems.Naming.TreeNode.FindBestMatch C# (CSharp) Method

FindBestMatch() public method

public FindBestMatch ( ComponentName name ) : TreeNode
name ComponentName
return TreeNode
		public TreeNode FindBestMatch(ComponentName name)
		{
			if ("*".Equals(name.LiteralProperties))
			{
				return this;
			}
			else if (name.LiteralProperties == null || name.LiteralProperties == string.Empty)
			{
				return FindWithEmptyProperties();
			}
			else
			{
				return FindBestMatchByProperties(name);
			}
		}

Usage Example

Exemplo n.º 1
0
        internal TreeNode FindNode(ComponentName name)
        {
            TreeNode current = root;

            while (true)
            {
                int cmp = String.Compare(current.CompName.Service, name.Service);

                if (cmp < 0)
                {
                    if (current.Left != null)
                    {
                        current = current.Left;
                    }
                    else
                    {
                        return(null);
                    }
                }
                else if (cmp > 0)
                {
                    if (current.Right != null)
                    {
                        current = current.Right;
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(current.FindBestMatch(name));
                }
            }
        }