Decide if this interval is certainly greater than, possibly greater than, or can't be greater than `other` by returning `[true, true]`, `[false, true]` or `[false, false]` respectively. NOTE: This function only works with intervals of the same data type. Attempting to compare intervals of different data types will lead to an error.
(&self, other: T)
| 463 | /// Attempting to compare intervals of different data types will lead |
| 464 | /// to an error. |
| 465 | pub fn gt<T: Borrow<Self>>(&self, other: T) -> Result<Self> { |
| 466 | let rhs = other.borrow(); |
| 467 | let lhs_type = self.data_type(); |
| 468 | let rhs_type = rhs.data_type(); |
| 469 | assert_eq_or_internal_err!( |
| 470 | lhs_type, |
| 471 | rhs_type, |
| 472 | "Only intervals with the same data type are comparable, lhs:{}, rhs:{}", |
| 473 | self.data_type(), |
| 474 | rhs.data_type() |
| 475 | ); |
| 476 | if !(self.upper.is_null() || rhs.lower.is_null()) && self.upper <= rhs.lower { |
| 477 | // Values in this interval are certainly less than or equal to |
| 478 | // those in the given interval. |
| 479 | Ok(Self::FALSE) |
| 480 | } else if !(self.lower.is_null() || rhs.upper.is_null()) |
| 481 | && (self.lower > rhs.upper) |
| 482 | { |
| 483 | // Values in this interval are certainly greater than those in the |
| 484 | // given interval. |
| 485 | Ok(Self::TRUE) |
| 486 | } else { |
| 487 | // All outcomes are possible. |
| 488 | Ok(Self::TRUE_OR_FALSE) |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | /// Decide if this interval is certainly greater than or equal to, possibly |
| 493 | /// greater than or equal to, or can't be greater than or equal to `other` |
no test coverage detected