#Elevator Event.

1 messages · Page 1 of 1 (latest)

north sphinx
#

Well, I am confused, what does this method do?

        elevators.forEach(Elevator::moveOneFloor);
        elevators.forEach(elevator -> elevatorListeners.forEach(listener -> listener.onElevatorArrivedAtFloor(elevator)));
    }``` in the `ElevatorSystem.java` file?
Does it assign elevators to every elevatorListener(Humans)? and if so then what is the purpose of `requestElevator()` in the same file? Well it's written here, 
```// TODO Implement. This represents a human standing in the corridor,
        //  requesting that an elevator comes to pick them up for travel into the given direction.
        //  The system is supposed to make sure that an elevator will eventually reach this floor to pick up the human.
        //  The human can then enter the elevator and request their actual destination within the elevator.
        //  Ideally this has to select the best elevator among all which can reduce the time
        //  for the human spending waiting (either in corridor or in the elevator itself).```
But if we choose the elevator for every human already then what does the `moveOneFloor()` method does?
woven skyBOT
#

<@&987246399047479336> please have a look, thanks.

north sphinx
#

also, i am getting these errors.

#

also, it's annoying that this test check panel hides the screen. I can't read tasks properly.peepo_sad_2

lime osprey
#

that move method represents a single step

#

elevatorSystem is like the brain of all elevators, like the circuit in the basement that steers all elevators

#

the simulation calls its moveOneFloor method once per simulation step

#

and what it does is:

#

tell every elevator to execute one step of its logic (elevator moveOneFloor)

#

and

#

then it tells every human the floor at which every elevator is

#

so they can decide to enter or exit an elevator

#

the elevators decide in their moveOneFloor method whether they want to move one floor up, down or stay at the current floor

#

requestElevator is the action of humans pressing a button on the wall panel in the corridor and how the elevator system received and learns about a request to be served

#

upon which it will maybe select an elevator and tell it to eventually move to that floor

north sphinx
#

I see. But at time, i need to explicitly call the moveOneFloor() methos of the elevator to make it move to the requested floor. 😕 There are issue in my logic.

north sphinx