Trait elevate_lib::elevators::Elevators
source · pub trait Elevators {
// Required methods
fn get_dest_floors(&self) -> Vec<usize>;
fn get_energy_spent(&mut self) -> f64;
fn update_floors(&mut self);
fn increment_wait_times(&mut self);
fn append_elevator(
&mut self,
capacity: usize,
energy_up: f64,
energy_down: f64,
energy_coef: f64
);
fn update_capacities(&mut self, capacity: usize);
}Expand description
§Elevators trait
A Elevators implementation is representative of a collection of Elevators.
It is implemented by the Building struct.
Required Methods§
fn get_dest_floors(&self) -> Vec<usize>
fn get_energy_spent(&mut self) -> f64
fn update_floors(&mut self)
fn increment_wait_times(&mut self)
fn append_elevator( &mut self, capacity: usize, energy_up: f64, energy_down: f64, energy_coef: f64 )
fn update_capacities(&mut self, capacity: usize)
Implementations on Foreign Types§
source§impl Elevators for Vec<Elevator>
impl Elevators for Vec<Elevator>
source§fn get_dest_floors(&self) -> Vec<usize>
fn get_dest_floors(&self) -> Vec<usize>
Get an aggregated list of destination floors across the vector of elevators.
source§fn get_energy_spent(&mut self) -> f64
fn get_energy_spent(&mut self) -> f64
Calculate the total energy spent across the vector of elevators.
source§fn update_floors(&mut self)
fn update_floors(&mut self)
For each elevator, update its floor based on its stopped boolean and its
moving_up boolean.
source§fn increment_wait_times(&mut self)
fn increment_wait_times(&mut self)
For each elevator, increment the wait times of the people on the elevator if they are not on their desired floor.
source§fn append_elevator(
&mut self,
capacity: usize,
energy_up: f64,
energy_down: f64,
energy_coef: f64
)
fn append_elevator( &mut self, capacity: usize, energy_up: f64, energy_down: f64, energy_coef: f64 )
Appends a new elevator to the collection of elevators
source§fn update_capacities(&mut self, capacity: usize)
fn update_capacities(&mut self, capacity: usize)
Updates the capacity across each of the elevators