Exemplo n.º 1
0
            public void requestFloor(Elevator elevator)
            {
                Console.WriteLine("Moving elevator on floor " + elevator.currentFloor + " to the ground floor");

                int requestedFloor = 0;

                elevator.addToQueue(requestedFloor);
                elevator.closeDoors();
                elevator.move();
            }
Exemplo n.º 2
0
            public Elevator requestElevator(int requestedFloor, string direction)
            {
                if (requestedFloor < (Math.Abs(this.basements) * -1) || requestedFloor > (this.floors - this.basements))
                {
                    Console.WriteLine("Floor " + requestedFloor + " doesn't exist!");
                    throw new NotImplementedException();
                }

                int column = this.decideColumn(requestedFloor);

                Console.WriteLine("Called an elevator to the floor " + requestedFloor + " in the collumn #" + (column + 1));

                Elevator elevator = this.findElevator(requestedFloor, direction, column);

                elevator.addToQueue(requestedFloor);
                elevator.move();
                return(elevator);
            }