예제 #1
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));
        }
예제 #2
0
        public static string ParseEnumTravelType(EnumTravelType travelType)
        {
            string name = string.Empty;

            switch (travelType)
            {
            case EnumTravelType.Breadth:
                name = "广度";
                break;

            case EnumTravelType.Depth:
                name = "宽度";
                break;

            default:
                break;
            }
            return(name);
        }