| 162 | } |
| 163 | |
| 164 | fn group_gt_op( |
| 165 | &self, |
| 166 | other: &Box<dyn Value>, |
| 167 | group_op: &GroupComparisonOperator, |
| 168 | ) -> Result<Box<dyn Value>, String> { |
| 169 | if other.is_array_of(|element_type| element_type.is_float()) { |
| 170 | let elements = &other.as_array().unwrap(); |
| 171 | let mut matches_count = 0; |
| 172 | for element in elements.iter() { |
| 173 | if self.value > element.as_float().unwrap() { |
| 174 | matches_count += 1; |
| 175 | if GroupComparisonOperator::Any.eq(group_op) { |
| 176 | break; |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | let result = match group_op { |
| 182 | GroupComparisonOperator::All => matches_count == elements.len(), |
| 183 | GroupComparisonOperator::Any => matches_count > 0, |
| 184 | }; |
| 185 | |
| 186 | return Ok(Box::new(BoolValue::new(result))); |
| 187 | } |
| 188 | Err("Unexpected type to perform `>` with".to_string()) |
| 189 | } |
| 190 | |
| 191 | fn gte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 192 | if let Some(other_bool) = other.as_any().downcast_ref::<FloatValue>() { |