[][src]Trait analytic::iter::CommonRefinementZip

pub trait CommonRefinementZip<P, R, M> {
    fn common_refinement_zip<'a, F>(
        &'a self,
        other: &'a M,
        sort_fn: F
    ) -> CommonRefinementZipped<'a, P, R, M>
    where
        P: SubsetIndexable<R>,
        F: FnMut(&R, &R) -> Ordering
; }

P is the partition type R is the common refinement type M is the map type that maps partitions of type P to values

Required methods

fn common_refinement_zip<'a, F>(
    &'a self,
    other: &'a M,
    sort_fn: F
) -> CommonRefinementZipped<'a, P, R, M> where
    P: SubsetIndexable<R>,
    F: FnMut(&R, &R) -> Ordering

Loading content...

Implementations on Foreign Types

impl<V> CommonRefinementZip<OrderedIntervalPartitions<usize>, ContiguousIntegerSet<usize>, HashMap<ContiguousIntegerSet<usize>, V, RandomState>> for HashMap<UsizeInterval, V>[src]

fn common_refinement_zip<'a, F>(
    &'a self,
    other: &'a Self,
    sort_fn: F
) -> CommonRefinementZipped<'a, OrderedIntervalPartitions<usize>, UsizeInterval, Self> where
    F: FnMut(&UsizeInterval, &UsizeInterval) -> Ordering
[src]

use std::collections::HashMap;
use analytic::interval::traits::Interval;
use analytic::iter::{CommonRefinementZip, UsizeInterval};

let m1: HashMap<UsizeInterval, i32> = vec![
    (UsizeInterval::new(0usize, 5), 5),
    (UsizeInterval::new(8, 10), 2),
].into_iter().collect();

let m2: HashMap<UsizeInterval, i32> = vec![
    (UsizeInterval::new(2usize, 4), 8),
    (UsizeInterval::new(12, 13), 9),
].into_iter().collect();

let mut iter = m1
    .common_refinement_zip(&m2, |a, b| a.get_start().cmp(&b.get_start()))
    .into_iter();
assert_eq!(Some((UsizeInterval::new(0usize, 1), vec![Some(&5), None])), iter.next());
assert_eq!(Some((UsizeInterval::new(2usize, 4), vec![Some(&5), Some(&8)])), iter.next());
assert_eq!(Some((UsizeInterval::new(5usize, 5), vec![Some(&5), None])), iter.next());
assert_eq!(Some((UsizeInterval::new(8usize, 10), vec![Some(&2), None])), iter.next());
assert_eq!(Some((UsizeInterval::new(12usize, 13), vec![None, Some(&9)])), iter.next());
assert_eq!(None, iter.next());
Loading content...

Implementors

Loading content...