Class Elevator
java.lang.Object
org.episteme.social.architecture.lift.Elevator
- All Implemented Interfaces:
Serializable
Represents an autonomous elevator unit within a multi-floor transportation system.
It implements a collective control algorithm (also known as the SCAN or Elevator
algorithm) to optimize throughput and energy usage.
Reference: Knuth, D. E. (1973). The Art of Computer Programming, Vol. 1. Fundamental Algorithms.
* @version 2.0- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDirectional intent of the elevator motion.static enumFunctional states of the elevator cabin. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidBoards a passenger into the cabin if capacity permits.intintgetId()intgetState()voidhallCall(int floor, Elevator.Direction callDir) Registers an external hall call request from a specific floor.voidpressFloorButton(int floor) Registers a request from the cabin's internal operating panel.voidtick()Advances the elevator simulation by one discrete time step.
-
Constructor Details
-
Elevator
Initializes a new elevator cabin with a fixed capacity and operational range.- Parameters:
id- unique identifier for the cabincapacity- maximum number of passengers allowedmaxFloors- the total number of floors served by this lift
-
-
Method Details
-
getId
-
getCurrentFloor
public int getCurrentFloor() -
getState
-
getDirection
-
pressFloorButton
public void pressFloorButton(int floor) Registers a request from the cabin's internal operating panel.- Parameters:
floor- the target destination floor index
-
hallCall
Registers an external hall call request from a specific floor.- Parameters:
floor- the floor where the call originatedcallDir- the intended travel direction (UP or DOWN)
-
tick
public void tick()Advances the elevator simulation by one discrete time step. Processes motion physics, door timing, and logic transitions. -
addPassenger
Boards a passenger into the cabin if capacity permits.- Parameters:
p- the passenger attempting to board
-
getPassengerCount
public int getPassengerCount()- Returns:
- the number of passengers currently in the cabin
-
getCapacity
public int getCapacity()- Returns:
- the maximum load capacity of the cabin
-