Example #1
0
        private EFloor()
        {
            this.maxCapacity = Capacities.Get("Floor");
            WelcomeRoom      = new List <Visitor>();
            int i = 0;

            while (i < 10)
            {
                offices[i] = new Office();
                i++;
            }
        }
Example #2
0
 public static EFloor Get(int floorNumber)
 {
     eFloors = new EFloor[Capacities.Get("NumberOfFloors")];
     if (floorNumber > eFloors.Length || floorNumber < 0)
     {
         return(null);
     }
     if (eFloors[floorNumber - 1] == null)
     {
         eFloors[floorNumber - 1] = new EFloor();
     }
     return(eFloors[floorNumber - 1]);
 }
Example #3
0
        public void Main()
        {
            eFloor      = new EFloor[Capacities.Get("NumberOfFloors")];
            lift        = new Lift();
            groundFloor = LocationSingletory.GetLocation(0) as GroundFloor;
            int i = 1;

            while (i <= eFloor.Length)
            {
                var newFloor = LocationSingletory.GetLocation(i) as EFloor;
                eFloor[i - 1] = newFloor;
                i++;
            }
            getVisitors();
            lift.Operate();
            printStats();
        }
Example #4
0
        private void getVisitors()
        {
            Random random    = new Random();
            var    kVisitors = Capacities.Get("Visitors");

            while (kVisitors > 0)
            {
                Visitor visitor = new Visitor(random.Next(1, (eFloor.Length + 1)), random.Next(0, 9));
                if (IsThereSpace)
                {
                    groundFloor.Enter(visitor);
                }
                else
                {
                    Console.WriteLine("Please come again tomorrow");
                }
                kVisitors--;
            }
        }
Example #5
0
 private GroundFloor()
 {
     this.maxCapacity = Capacities.Get("Groundfloor");
     WelcomeRoom      = new List <Visitor>();
     waitingRoom      = new Queue <Visitor>();
 }
Example #6
0
 public Building()
 {
     this.MaxCapacity = Capacities.Get("Building");
 }
Example #7
0
 public Office()
 {
     Visitors         = new Queue <Visitor>();
     this.MaxCapacity = Capacities.Get("Office");
 }
Example #8
0
 public Lift()
 {
     Visitors    = new List <Visitor>();
     maxCapacity = Capacities.Get("Lift");
     cycles      = Capacities.Get("Cycles");
 }