Beispiel #1
0
 public static Capacities Instance()
 {
     if (instance == null)
     {
         instance = new Capacities();
     }
     return(instance);
 }
Beispiel #2
0
        private EFloor()
        {
            this.maxCapacity = Capacities.Get("Floor");
            WelcomeRoom      = new List <Visitor>();
            int i = 0;

            while (i < 10)
            {
                offices[i] = new Office();
                i++;
            }
        }
Beispiel #3
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]);
 }
Beispiel #4
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();
        }
Beispiel #5
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--;
            }
        }
Beispiel #6
0
 private GroundFloor()
 {
     this.maxCapacity = Capacities.Get("Groundfloor");
     WelcomeRoom      = new List <Visitor>();
     waitingRoom      = new Queue <Visitor>();
 }
Beispiel #7
0
 public Building()
 {
     this.MaxCapacity = Capacities.Get("Building");
 }
Beispiel #8
0
 public Office()
 {
     Visitors         = new Queue <Visitor>();
     this.MaxCapacity = Capacities.Get("Office");
 }
Beispiel #9
0
 public Lift()
 {
     Visitors    = new List <Visitor>();
     maxCapacity = Capacities.Get("Lift");
     cycles      = Capacities.Get("Cycles");
 }