Skip to main content

nominal_api/conjure/objects/scout/compute/api/
thresholding_ranges.rs

1/// Produces a list of ranges for which the threshold condition is satisfied.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct ThresholdingRanges {
14    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
15    #[serde(rename = "input")]
16    input: Box<super::NumericSeries>,
17    #[builder(custom(type = super::DoubleConstant, convert = Box::new))]
18    #[serde(rename = "threshold")]
19    threshold: Box<super::DoubleConstant>,
20    #[serde(rename = "operator")]
21    operator: super::ThresholdOperator,
22    #[builder(
23        default,
24        custom(
25            type = impl
26            Into<Option<super::PersistenceWindowConfiguration>>,
27            convert = |v|v.into().map(Box::new)
28        )
29    )]
30    #[serde(
31        rename = "persistenceWindowConfiguration",
32        skip_serializing_if = "Option::is_none",
33        default
34    )]
35    persistence_window_configuration: Option<Box<super::PersistenceWindowConfiguration>>,
36}
37impl ThresholdingRanges {
38    /// Constructs a new instance of the type.
39    #[inline]
40    pub fn new(
41        input: super::NumericSeries,
42        threshold: super::DoubleConstant,
43        operator: super::ThresholdOperator,
44    ) -> Self {
45        Self::builder().input(input).threshold(threshold).operator(operator).build()
46    }
47    #[inline]
48    pub fn input(&self) -> &super::NumericSeries {
49        &*self.input
50    }
51    #[inline]
52    pub fn threshold(&self) -> &super::DoubleConstant {
53        &*self.threshold
54    }
55    #[inline]
56    pub fn operator(&self) -> &super::ThresholdOperator {
57        &self.operator
58    }
59    #[inline]
60    pub fn persistence_window_configuration(
61        &self,
62    ) -> Option<&super::PersistenceWindowConfiguration> {
63        self.persistence_window_configuration.as_ref().map(|o| &**o)
64    }
65}