Пример #1
0
        public static string ParseEnumArithmeticType(EnumArithmeticType arithmeticType)
        {
            string name = string.Empty;

            switch (arithmeticType)
            {
            case EnumArithmeticType.Recursion:
                name = "递归算法";
                break;

            case EnumArithmeticType.UnRecursion:
                name = "非递归算法";
                break;

            default:
                break;
            }
            return(name);
        }
Пример #2
0
        /// <summary>
        /// 打印遍历节点名称
        /// </summary>
        /// <param name="travelNodes"></param>
        /// <param name="travelType"></param>
        /// <param name="travelOrder"></param>
        /// <param name="arithmeticType"></param>
        public static void PrintTravelNodeNames(List <MTreeNode> travelNodes,
                                                EnumTravelType travelType, EnumTravelOrder travelOrder, EnumArithmeticType arithmeticType)
        {
            string names              = string.Empty;
            string travelTypeName     = string.Empty;
            string travelOrderName    = string.Empty;
            string arithmeticTypeName = string.Empty;

            for (int i = 0; i < travelNodes.Count; i++)
            {
                if (i == 0)
                {
                    names += string.Format("{0}", travelNodes[i].Name);
                }
                else
                {
                    names += string.Format(",{0}", travelNodes[i].Name);
                }
            }

            LogHelper.GetInstance().WriteLog(string.Format("多叉树{0}优先{1}遍历({2}):{3}",
                                                           EnumParser.ParseEnumTravelType(travelType),
                                                           EnumParser.ParseEnumTravelOrder(travelOrder),
                                                           EnumParser.ParseEnumArithmeticType(arithmeticType),
                                                           names));
        }