Beispiel #1
0
        static void Main(string[] args)
        {
            double longitude = 37.61;
            double latitude  = 55.74;

            HouseFactory houseFactory = new HouseFactory();

            for (int i = 0; i < 5; i++)
            {
                House panelHouse = houseFactory.GetHouse("Panel");
                if (panelHouse != null)
                {
                    panelHouse.Build(longitude, latitude);
                }
                longitude += 0.1;
                latitude  += 0.1;
            }

            for (int i = 0; i < 5; i++)
            {
                House brickHouse = houseFactory.GetHouse("Brick");
                if (brickHouse != null)
                {
                    brickHouse.Build(longitude, latitude);
                }
                longitude += 0.1;
                latitude  += 0.1;
            }

            Console.Read();
        }
Beispiel #2
0
        /// <summary>
        /// The main.
        /// </summary>
        private static void Main()
        {
            var houseList    = new List <House>();
            var houseFactory = new HouseFactory();

            for (var i = 0; i < 5; i++)
            {
                var house = houseFactory.GetHouse("Panel");
                houseList.Add(house);
            }

            for (var i = 0; i < 5; i++)
            {
                var house = houseFactory.GetHouse("Brick");
                houseList.Add(house);
            }

            int count = 0;

            foreach (var house in houseList)
            {
                house.Run(count++);
            }

            Console.ReadLine();
        }
Beispiel #3
0
        private static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.Title           = "FlyWeight";

            var longitude = 37.61;
            var latitude  = 55.74;

            var houseFactory = new HouseFactory();

            for (var i = 0; i < 5; i++)
            {
                var panelHouse = houseFactory.GetHouse("Panel");
                if (panelHouse != null)
                {
                    panelHouse.Build(longitude, latitude);
                }
                longitude += 0.1;
                latitude  += 0.1;
            }

            for (var i = 0; i < 5; i++)
            {
                var brickHouse = houseFactory.GetHouse("Brick");
                if (brickHouse != null)
                {
                    brickHouse.Build(longitude, latitude);
                }
                longitude += 0.1;
                latitude  += 0.1;
            }

            Console.ReadKey();
        }
Beispiel #4
0
        public static void Test()
        {
            HouseFactory factory = new HouseFactory();
            Random       random  = new Random();

            for (int y = 0; y < 3; y++)
            {
                for (int x = 0; x < 3; x++)
                {
                    HouseFactory.HOUSE_TYPES type = (HouseFactory.HOUSE_TYPES)random.Next(
                        0, Enum.GetValues(typeof(HouseFactory.HOUSE_TYPES)).Length);
                    factory.GetHouse(type).Build(x, y);
                }
            }
        }