pub trait Floors {
    // Required methods
    fn are_people_waiting_on_floor(&self, floor_index: usize) -> bool;
    fn get_nearest_wait_floor(&self, floor_on: usize) -> (usize, usize);
    fn get_dest_probabilities(&self) -> Vec<f64>;
    fn gen_people_leaving(&mut self, rng: &mut impl Rng);
    fn flush_first_floor(&mut self) -> Vec<Person>;
    fn increment_wait_times(&mut self);
    fn append_floor(&mut self, capacity: usize);
    fn update_capacities(&mut self, capacity: usize);
}
Expand description

§Floors trait

A Floors implementation is representative of a collection of Floors. It is implemented by the Building struct.

Required Methods§

source

fn are_people_waiting_on_floor(&self, floor_index: usize) -> bool

Expected to determine whether there are any people waiting on a given floor. Returns a bool which is true if so, and false if not.

source

fn get_nearest_wait_floor(&self, floor_on: usize) -> (usize, usize)

Expected to determine the nearest floor at which people are waiting with respect to the given floor. Returns a tuple of usizes representing the floor index and the distance to the floor.

source

fn get_dest_probabilities(&self) -> Vec<f64>

Expected to get the probability that each floor becomes a destination floor in the next time step.

source

fn gen_people_leaving(&mut self, rng: &mut impl Rng)

Expected to randomly generate the people leaving each floor using each Floor’s gen_people_leaving function, which itself uses each Person’s gen_is_leaving function.

source

fn flush_first_floor(&mut self) -> Vec<Person>

Expected to remove anyone who is leaving the first floor.

source

fn increment_wait_times(&mut self)

Expected to increment the waiting times among people who are waiting/not at their destination floor throughout the collection of floors.

source

fn append_floor(&mut self, capacity: usize)

Expected to append a new floor to the collection of floors.

source

fn update_capacities(&mut self, capacity: usize)

Expected to update the capacities across each of the floors.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Floors for Vec<Floor>

source§

fn are_people_waiting_on_floor(&self, floor_index: usize) -> bool

Determines whether there are any people waiting on a given floor. Returns a bool which is true if so, and false if not.

source§

fn get_nearest_wait_floor(&self, floor_on: usize) -> (usize, usize)

Determines the nearest floor at which people are waiting with respect to the given floor. Returns a tuple of usizes representing the floor index and the distance to the floor.

source§

fn get_dest_probabilities(&self) -> Vec<f64>

Gets the probability that each floor becomes a destination floor in the next time step.

source§

fn gen_people_leaving(&mut self, rng: &mut impl Rng)

Randomly generates the people leaving each floor using each Floor’s gen_people_leaving function, which itself uses each Person’s gen_is_leaving function.

source§

fn flush_first_floor(&mut self) -> Vec<Person>

Removes anyone who is leaving the first floor and returns the people who left as a vec of people.

source§

fn increment_wait_times(&mut self)

Increments the waiting times among people who are waiting/not at their destination floor throughout the collection of floors.

source§

fn append_floor(&mut self, capacity: usize)

Appends a new floor to the collection of floors.

source§

fn update_capacities(&mut self, capacity: usize)

Updates the capacity across each of the floors

Implementors§