pub fn compare_delay(&self, now: Time, before: &Analytics) -> Vec<(IntersectionID, Duration)> {
        let mut results = Vec::new();
        for (i, list1) in &self.intersection_delays {
            if let Some(list2) = before.intersection_delays.get(i) {
                let mut sum1 = Duration::ZERO;
                for (t, dt, _) in list1 {
                    if *t > now {
                        break;
                    }
                    sum1 += *dt;
                }

                let mut sum2 = Duration::ZERO;
                for (t, dt, _) in list2 {
                    if *t > now {
                        break;
                    }
                    sum2 += *dt;
                }

                if sum1 != sum2 {
                    results.push((*i, sum1 - sum2));
                }
            }
        }
        results
    }
// Find intersections where the cumulative sum of delay has changed. Negative means faster.
Find intersections where the cumulative sum of delay has changed. Negative means faster.
Find intersections where the cumulative sum of delay has changed . Negative means faster .
pub fn compare_delay(&self, now: Time, before: &Analytics) -> Vec<(IntersectionID, Duration)> {
        let mut results = Vec::new();
        for (i, list1) in &self.intersection_delays {
            if let Some(list2) = before.intersection_delays.get(i) {
                let mut sum1 = Duration::ZERO;
                for (t, dt, _) in list1 {
                    if *t > now {
                        break;
                    }
                    sum1 += *dt;
                }
                let mut sum2 = Duration::ZERO;
                for (t, dt, _) in list2 {
                    if *t > now {
                        break;
                    }
                    sum2 += *dt;
                }
                if sum1 != sum2 {
                    results.push((*i, sum1 - sum2));
                }
            }
        }
        results
    }
pub fn compare_delay ( & self , now : Time , before : & Analytics ) -> Vec < ( IntersectionID , Duration ) > { let mut results = Vec :: new ( ) ; for ( i , list1 ) in & self . intersection_delays { if let Some ( list2 ) = before . intersection_delays . get ( i ) { let mut sum1 = Duration :: ZERO ; for ( t , dt , _ ) in list1 { if * t > now { break ; } sum1 += * dt ; } let mut sum2 = Duration :: ZERO ; for ( t , dt , _ ) in list2 { if * t > now { break ; } sum2 += * dt ; } if sum1 != sum2 { results . push ( ( * i , sum1 - sum2 ) ) ; } } } results }
Find intersections where the cumulative sum of delay has changed.
Find intersections where the cumulative sum of delay has changed .
&self
now
Time
before
&Analytics