| 197 | } |
| 198 | |
| 199 | fn group_gte_op( |
| 200 | &self, |
| 201 | other: &Box<dyn Value>, |
| 202 | group_op: &GroupComparisonOperator, |
| 203 | ) -> Result<Box<dyn Value>, String> { |
| 204 | if other.is_array_of(|element_type| element_type.is_float()) { |
| 205 | let elements = &other.as_array().unwrap(); |
| 206 | let mut matches_count = 0; |
| 207 | for element in elements.iter() { |
| 208 | if self.value >= element.as_float().unwrap() { |
| 209 | matches_count += 1; |
| 210 | if GroupComparisonOperator::Any.eq(group_op) { |
| 211 | break; |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | let result = match group_op { |
| 217 | GroupComparisonOperator::All => matches_count == elements.len(), |
| 218 | GroupComparisonOperator::Any => matches_count > 0, |
| 219 | }; |
| 220 | |
| 221 | return Ok(Box::new(BoolValue::new(result))); |
| 222 | } |
| 223 | Err("Unexpected type to perform `>=` with".to_string()) |
| 224 | } |
| 225 | |
| 226 | fn lt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 227 | if let Some(other_bool) = other.as_any().downcast_ref::<FloatValue>() { |