Compute the logical disjunction of this boolean interval with the given boolean interval.
(&self, other: T)
| 605 | /// Compute the logical disjunction of this boolean interval with the |
| 606 | /// given boolean interval. |
| 607 | pub fn or<T: Borrow<Self>>(&self, other: T) -> Result<Self> { |
| 608 | let rhs = other.borrow(); |
| 609 | match (&self.lower, &self.upper, &rhs.lower, &rhs.upper) { |
| 610 | ( |
| 611 | &ScalarValue::Boolean(Some(self_lower)), |
| 612 | &ScalarValue::Boolean(Some(self_upper)), |
| 613 | &ScalarValue::Boolean(Some(other_lower)), |
| 614 | &ScalarValue::Boolean(Some(other_upper)), |
| 615 | ) => { |
| 616 | let lower = self_lower || other_lower; |
| 617 | let upper = self_upper || other_upper; |
| 618 | |
| 619 | Ok(Self { |
| 620 | lower: ScalarValue::Boolean(Some(lower)), |
| 621 | upper: ScalarValue::Boolean(Some(upper)), |
| 622 | }) |
| 623 | } |
| 624 | |
| 625 | // Return TRUE_OR_FALSE when intervals don't have concrete boolean bounds |
| 626 | _ => Ok(Self::TRUE_OR_FALSE), |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | /// Compute the logical negation of this (boolean) interval. |
| 631 | pub fn not(&self) -> Result<Self> { |