| 232 | } |
| 233 | |
| 234 | fn group_lt_op( |
| 235 | &self, |
| 236 | other: &Box<dyn Value>, |
| 237 | group_op: &GroupComparisonOperator, |
| 238 | ) -> Result<Box<dyn Value>, String> { |
| 239 | if other.is_array_of(|element_type| element_type.is_float()) { |
| 240 | let elements = &other.as_array().unwrap(); |
| 241 | let mut matches_count = 0; |
| 242 | for element in elements.iter() { |
| 243 | if self.value < element.as_float().unwrap() { |
| 244 | matches_count += 1; |
| 245 | if GroupComparisonOperator::Any.eq(group_op) { |
| 246 | break; |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | let result = match group_op { |
| 252 | GroupComparisonOperator::All => matches_count == elements.len(), |
| 253 | GroupComparisonOperator::Any => matches_count > 0, |
| 254 | }; |
| 255 | |
| 256 | return Ok(Box::new(BoolValue::new(result))); |
| 257 | } |
| 258 | Err("Unexpected type to perform `<` with".to_string()) |
| 259 | } |
| 260 | |
| 261 | fn lte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 262 | if let Some(other_bool) = other.as_any().downcast_ref::<FloatValue>() { |