| 125 | } |
| 126 | |
| 127 | fn group_gt_op( |
| 128 | &self, |
| 129 | other: &Box<dyn Value>, |
| 130 | group_op: &GroupComparisonOperator, |
| 131 | ) -> Result<Box<dyn Value>, String> { |
| 132 | if other.is_array_of(|element_type| element_type.is_time()) { |
| 133 | let elements = &other.as_array().unwrap(); |
| 134 | let mut matches_count = 0; |
| 135 | for element in elements.iter() { |
| 136 | if self.value > element.as_time().unwrap() { |
| 137 | matches_count += 1; |
| 138 | if GroupComparisonOperator::Any.eq(group_op) { |
| 139 | break; |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | let result = match group_op { |
| 145 | GroupComparisonOperator::All => matches_count == elements.len(), |
| 146 | GroupComparisonOperator::Any => matches_count > 0, |
| 147 | }; |
| 148 | |
| 149 | return Ok(Box::new(BoolValue::new(result))); |
| 150 | } |
| 151 | Err("Unexpected type to perform `>` with".to_string()) |
| 152 | } |
| 153 | |
| 154 | fn gte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 155 | if let Some(other_text) = other.as_any().downcast_ref::<TimeValue>() { |