예제 #1
0
        static void Main(string[] args)
        {
            string text      = "AAZZBBZBAABZ";
            var    factory   = new CharacterFactory();
            int    pointSize = 10;

            foreach (var c in text)
            {
                pointSize++;
                Character character = factory.GetCharacter(c);
                character.Display(pointSize);
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            string document = "AABBABABAAABBA";

            char[] chars = document.ToArray();

            CharacterFactory factory = new CharacterFactory();

            int pointSize = 10;

            foreach (char c in chars)
            {
                pointSize++;
                Character character = factory.GetCharacter(c);
                character.Display(pointSize);
            }

            Console.ReadKey();
        }
예제 #3
0
        public static void Main(string[] args)
        {
            //Structure;
            //int extrinsicstate = 22;

            //FlyweightFactory factory = new FlyweightFactory();

            //Flyweight fx = factory.GetFlyweight("X");
            //fx.Operation(--extrinsicstate);

            //Flyweight fy = factory.GetFlyweight("Y");
            //fy.Operation(--extrinsicstate);

            //Flyweight fz = factory.GetFlyweight("Z");
            //fz.Operation(--extrinsicstate);

            //UnsharedConcreteFlyweight fu = new UnsharedConcreteFlyweight();
            //fu.Operation(--extrinsicstate);


            //Practical
            string document = "AAZZBBZZBB";

            char[] chars = document.ToCharArray();

            CharacterFactory factory = new CharacterFactory();

            int pointSize = 10;

            foreach (char c in chars)
            {
                pointSize++;
                Character character = factory.GetCharacter(c);
                character.Display(pointSize);
            }


            Console.ReadLine();
        }