Compute the logical conjunction of this (boolean) interval with the given boolean interval.
(&self, other: T)
| 580 | /// Compute the logical conjunction of this (boolean) interval with the |
| 581 | /// given boolean interval. |
| 582 | pub fn and<T: Borrow<Self>>(&self, other: T) -> Result<Self> { |
| 583 | let rhs = other.borrow(); |
| 584 | match (&self.lower, &self.upper, &rhs.lower, &rhs.upper) { |
| 585 | ( |
| 586 | &ScalarValue::Boolean(Some(self_lower)), |
| 587 | &ScalarValue::Boolean(Some(self_upper)), |
| 588 | &ScalarValue::Boolean(Some(other_lower)), |
| 589 | &ScalarValue::Boolean(Some(other_upper)), |
| 590 | ) => { |
| 591 | let lower = self_lower && other_lower; |
| 592 | let upper = self_upper && other_upper; |
| 593 | |
| 594 | Ok(Self { |
| 595 | lower: ScalarValue::Boolean(Some(lower)), |
| 596 | upper: ScalarValue::Boolean(Some(upper)), |
| 597 | }) |
| 598 | } |
| 599 | |
| 600 | // Return TRUE_OR_FALSE when intervals don't have concrete boolean bounds |
| 601 | _ => Ok(Self::TRUE_OR_FALSE), |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | /// Compute the logical disjunction of this boolean interval with the |
| 606 | /// given boolean interval. |