Trait necsim_core::cogs::habitat::Habitat
source · pub trait Habitat<M: MathsCore>: Backup + Debug + Sized {
type LocationIterator<'a>: Iterator<Item = Location> + 'a
where Self: 'a;
// Provided methods
fn is_finite(&self) -> bool { ... }
fn get_extent(&self) -> &LandscapeExtent { ... }
fn is_location_habitable(&self, location: &Location) -> bool { ... }
fn is_indexed_location_habitable(
&self,
indexed_location: &IndexedLocation
) -> bool { ... }
fn get_total_habitat(&self) -> OffByOneU64 { ... }
fn get_habitat_at_location(&self, location: &Location) -> u32 { ... }
fn map_indexed_location_to_u64_injective(
&self,
indexed_location: &IndexedLocation
) -> u64 { ... }
fn iter_habitable_locations(&self) -> Self::LocationIterator<'_> { ... }
}
Required Associated Types§
type LocationIterator<'a>: Iterator<Item = Location> + 'a where Self: 'a
Provided Methods§
fn is_finite(&self) -> bool
fn get_extent(&self) -> &LandscapeExtent
fn is_location_habitable(&self, location: &Location) -> bool
fn is_indexed_location_habitable( &self, indexed_location: &IndexedLocation ) -> bool
sourcefn get_total_habitat(&self) -> OffByOneU64
fn get_total_habitat(&self) -> OffByOneU64
§Contracts
Post-condition - debug: total habitat is the sum of all habitat in the extent of the habitat
! self.is_finite() || ret.get() == { self.iter_habitable_locations().map(|location| u128::from(self.get_habitat_at_location(&location))).sum() }
sourcefn get_habitat_at_location(&self, location: &Location) -> u32
fn get_habitat_at_location(&self, location: &Location) -> u32
§Contracts
Pre-condition - debug: location is inside habitat extent
self.get_extent().contains(location)
sourcefn map_indexed_location_to_u64_injective(
&self,
indexed_location: &IndexedLocation
) -> u64
fn map_indexed_location_to_u64_injective( &self, indexed_location: &IndexedLocation ) -> u64
§Contracts
Pre-condition - debug: location is inside habitat extent
self.get_extent().contains(indexed_location.location())
Pre-condition - debug: index is within the location’s habitat capacity
indexed_location.index() < self.get_habitat_at_location(indexed_location.location())
fn iter_habitable_locations(&self) -> Self::LocationIterator<'_>
Object Safety§
This trait is not object safe.