| 259 | } |
| 260 | |
| 261 | fn group_gte_op( |
| 262 | &self, |
| 263 | other: &Box<dyn Value>, |
| 264 | group_op: &GroupComparisonOperator, |
| 265 | ) -> Result<Box<dyn Value>, String> { |
| 266 | if other.is_array_of(|element_type| element_type.is_int()) { |
| 267 | let elements = &other.as_array().unwrap(); |
| 268 | let mut matches_count = 0; |
| 269 | for element in elements.iter() { |
| 270 | if self.value >= element.as_int().unwrap() { |
| 271 | matches_count += 1; |
| 272 | if GroupComparisonOperator::Any.eq(group_op) { |
| 273 | break; |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | let result = match group_op { |
| 279 | GroupComparisonOperator::All => matches_count == elements.len(), |
| 280 | GroupComparisonOperator::Any => matches_count > 0, |
| 281 | }; |
| 282 | |
| 283 | return Ok(Box::new(BoolValue::new(result))); |
| 284 | } |
| 285 | Err("Unexpected type to perform `>=` with".to_string()) |
| 286 | } |
| 287 | |
| 288 | fn lt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 289 | if let Some(other_bool) = other.as_any().downcast_ref::<IntValue>() { |