/// <summary>
        /// Invokes named rule specified by rule path.
        /// </summary>
        /// <typeparam name="T">Result type</typeparam>
        /// <param name="rulePath">Path of the named rule</param>
        /// <param name="arguments">Arguments required by the named rule</param>
        /// <returns>Execution result, or default(T) if the rule does not exist</returns>
        public T InvokeNamedRule <T>(string rulePath, Dictionary <string, object> arguments)
        {
            string rulePointPath;
            string ruleName;

            if (RulePathHelper.ExtractNamedRulePath(rulePath, out rulePointPath, out ruleName))
            {
                return(InvokeNamedRule <T>(rulePointPath, ruleName, arguments));
            }
            else
            {
                return(default(T));
            }
        }
        /// <summary>
        /// Gets a rule point by a given path.
        /// </summary>
        /// <param name="rulePointPath">The path of the rule point you want to get</param>
        /// <returns>The rule point if it exists; otherwise, null.</returns>
        public RulePoint GetRulePoint(string rulePointPath)
        {
            RulePoint iter = RootRulePoint;

            string[] pathItems = RulePathHelper.GetRulePathComponents(rulePointPath);
            foreach (string item in pathItems)
            {
                iter = iter.GetSubRulePoint(item);
                if (iter == null)
                {
                    return(null);
                }
            }
            return(iter);
        }
        /// <summary>
        /// Gets a named rule by a given path.
        /// </summary>
        /// <param name="rulePath">The path of the named rule you want to get</param>
        /// <returns>The named rule if it exists; otherwise, null.</returns>
        public NamedRule GetNamedRule(string rulePath)
        {
            if (String.IsNullOrEmpty(rulePath))
            {
                throw new ArgumentNullException("rulePath"); // NOXLATE
            }

            string rulePointPath;
            string ruleName;

            if (RulePathHelper.ExtractNamedRulePath(rulePath, out rulePointPath, out ruleName))
            {
                RulePoint theRulePoint = GetRulePoint(rulePointPath);
                if (theRulePoint != null)
                {
                    return(theRulePoint.GetNamedRule(ruleName));
                }
            }
            return(null);
        }
        /// <summary>
        /// Gets a rule point by a given path. Returns the lowest level sub rule point in
        /// the heirarchy which has a valid activity defined.
        /// </summary>
        /// <param name="rulePointPath">The path of the rule point you want to get</param>
        /// <returns>The lowest level rule point in the path that has an activity; otherwise, null.</returns>
        public RulePoint GetRulePointWithActivity(string rulePointPath)
        {
            RulePoint activityPoint = null;
            RulePoint iter          = RootRulePoint;

            string[] pathItems = RulePathHelper.GetRulePathComponents(rulePointPath);
            foreach (string item in pathItems)
            {
                iter = iter.GetSubRulePoint(item);
                if (iter == null)
                {
                    return(activityPoint);
                }
                else if (iter.HasActivity)
                {
                    activityPoint = iter;
                }
            }
            return(activityPoint);
        }
        /// <summary>
        /// Registers a new rule point with specified position.
        /// </summary>
        /// <param name="parentPath">A string representing the position where the rule point goes.</param>
        /// <param name="name">The name of rule point.</param>
        /// <param name="displayName">The display name of rule point.</param>
        /// <param name="signature">The signature of rule point.</param>
        public void RegisterRulePoint(string parentPath, string name, string displayName, RuleSignature signature)
        {
            RulePoint rulePoint = new RulePoint(this, name, signature, displayName);

            // Create rule points recursively.
            RulePoint iter = RootRulePoint;

            string[] pathItems = RulePathHelper.GetRulePathComponents(parentPath);
            foreach (string item in pathItems)
            {
                if (!iter.HasChild(item))
                {
                    iter.AddRulePoint(new RulePoint(this, item));
                }
                iter = iter.GetSubRulePoint(item);
                if (iter == null)
                {
                    throw new InvalidOperationException(Properties.Resources.CannotRegisterRulePoint);
                }
            }

            iter.AddRulePoint(rulePoint);
        }