Example #1
0
        // Constructor of the Battery Object Class
        public Battery(int _columnAmount, int _floorAmount, int _elevatorAmountPerColumn, int _lobby, int _minFloor, int _maxfloor)
        {
            columnAmount            = _columnAmount;
            floorAmount             = _floorAmount;
            elevatorAmountPerColumn = _elevatorAmountPerColumn;
            _lobby   = 1;
            minFloor = _minFloor;
            maxFloor = _maxfloor;

            /* Console.WriteLine("COLUMN LIST :"); */
            // This is where the Column List is created
            for (int i = 0; i < _columnAmount; i++)
            {
                if (i == 0)
                {
                    Column column = new Column("A", 66, 5, 1, -6, -1);
                    columnList.Add(column);
                    //Console.WriteLine("Column {0}\n", columnList[i].id);
                }
                else if (i == 1)
                {
                    Column column = new Column("B", 66, 5, 1, 2, 20);
                    columnList.Add(column);
                    //Console.WriteLine("Column {0}\n", columnList[i].id);
                }
                else if (i == 2)
                {
                    Column column = new Column("C", 66, 5, 1, 21, 40);
                    columnList.Add(column);
                    //Console.WriteLine("Column {0}\n", columnList[i].id);
                }
                else
                {
                    Column column = new Column("D", 66, 5, 1, 41, 60);
                    columnList.Add(column);
                    //Console.WriteLine("Column {0}\n", columnList[i].id);
                }
            }
            // This is where the CallButton List is created
            for (int i = 0; i < _floorAmount - 1; i++)
            {
                if (i <= 5)
                {
                    CallButton callButton = new CallButton(i - 6, "up");
                    callButtonList.Add(callButton);
                    //Console.WriteLine("Call Button {0}", callButtonList[i].id);
                }
                else if (i >= 6)
                {
                    CallButton callButton = new CallButton(i - 4, "down");
                    callButtonList.Add(callButton);
                    //Console.WriteLine("Call Button {0}", callButtonList[i].id);
                }
            }
            // This is where the Floor Request Panel of the Lobby is created
            for (int i = 0; i < _lobby; i++)
            {
                FloorRequestPanel floorRequestPanel = new FloorRequestPanel(_floorAmount);
                floorRequestPanelList.Add(floorRequestPanel);
                //Console.WriteLine("Lobby Floor Request Panel");
            }
        }