use crate::core::VerticalDistance;
use crate::measurements::{Length, Temperature};
use super::{AlteringFactor, AlteringFactors, TakeoffLandingPerformance};
pub struct TakeoffLandingPerformanceBuilder {
table: Vec<(VerticalDistance, Temperature, Length, Length)>,
factors: Option<AlteringFactors>,
notes: Option<String>,
}
impl TakeoffLandingPerformanceBuilder {
pub fn new<I>(table: I) -> Self
where
I: IntoIterator<Item = (VerticalDistance, Temperature, Length, Length)>,
{
Self {
table: table.into_iter().collect(),
factors: None,
notes: None,
}
}
pub fn build(&self) -> TakeoffLandingPerformance {
TakeoffLandingPerformance::new(self.table.clone(), self.factors.clone(), self.notes.clone())
}
pub fn factors<I>(&mut self, factors: I) -> &mut Self
where
I: IntoIterator<Item = AlteringFactor>,
{
self.factors = Some(AlteringFactors::new(factors));
self
}
pub fn notes(&mut self, notes: String) -> &mut Self {
self.notes = Some(notes);
self
}
}