Checks whether a value is between the from and to values of a Range @param value the value of interest @return true if the value is within the bounds
(Object value)
| 276 | * @return true if the value is within the bounds |
| 277 | */ |
| 278 | @Override |
| 279 | public boolean containsWithinBounds(Object value) { |
| 280 | if (value instanceof Comparable) { |
| 281 | final int result = compareTo(from, (Comparable) value); |
| 282 | return result == 0 || result < 0 && compareTo(to, (Comparable) value) >= 0; |
| 283 | } |
| 284 | return contains(value); |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * Compares two values using Groovy's number-aware comparison. |