예제 #1
0
        private static void ShowHello()
        {
            Console.WriteLine("**********李四********");
            BaseWord h = FlyweightFactory.GetWord(WordType.H);
            BaseWord e = FlyweightFactory.GetWord(WordType.E);
            BaseWord l = FlyweightFactory.GetWord(WordType.L);
            BaseWord o = FlyweightFactory.GetWord(WordType.O);

            Console.WriteLine("{0}{1}{2}{3}{4}",
                              h.Display(), e.Display(),
                              l.Display(), l.Display(),
                              o.Display());
        }
예제 #2
0
        //private static BaseWord e1 = new E();
        //private static BaseWord l = new L();
        //private static BaseWord v = new V();
        //private static BaseWord n = new N();
        /// <summary>
        /// 张三
        /// </summary>
        private static void Show()
        {
            Console.WriteLine("**********张三********");
            //BaseWord e1 = new E();
            //BaseWord l = new L();
            ////BaseWord e2 = new E();
            //BaseWord v = new V();
            ////BaseWord e3 = new E();
            //BaseWord n = new N();

            BaseWord e1 = FlyweightFactory.GetWord(WordType.E);
            BaseWord l  = FlyweightFactory.GetWord(WordType.L);
            //BaseWord e2 = new E();
            BaseWord v = FlyweightFactory.GetWord(WordType.V);
            //BaseWord e3 = new E();
            BaseWord n = FlyweightFactory.GetWord(WordType.N);

            Console.WriteLine("{0}{1}{2}{3}{4}{5}",
                              e1.Display(), l.Display(),
                              e1.Display(), v.Display(),
                              e1.Display(), n.Display());
            //e2.Display(),v.Display(),
            //e3.Display(),n.Display());
        }