[][src]Struct analytic::set::ordered_integer_set::ContiguousIntegerSet

pub struct ContiguousIntegerSet<E: Integer + Copy> { /* fields omitted */ }

represents the set of integers in [start, end]

Methods

impl<E: Integer + Copy> ContiguousIntegerSet<E>[src]

pub fn new(start: E, end: E) -> ContiguousIntegerSet<E>[src]

pub fn get_start_and_end(&self) -> (E, E)[src]

pub fn is_subset_of(&self, other: &ContiguousIntegerSet<E>) -> bool[src]

pub fn slice<'a, I: Slicing<&'a ContiguousIntegerSet<E>, Option<ContiguousIntegerSet<E>>>>(
    &'a self,
    slicer: I
) -> Option<ContiguousIntegerSet<E>>
[src]

Trait Implementations

impl<E: Integer + Copy> Interval for ContiguousIntegerSet<E>[src]

type Element = E

impl<E: Integer + Copy> Coalesce<ContiguousIntegerSet<E>> for ContiguousIntegerSet<E>[src]

returns an interval if only if the two intervals can be merged into a single non-empty interval. An empty interval can be merged with any other non-empty interval

impl<E: Integer + Copy> Coalesce<E> for ContiguousIntegerSet<E>[src]

impl<E> CoalesceIntervals<ContiguousIntegerSet<E>, E> for OrderedIntegerSet<E> where
    E: Integer + Copy + ToPrimitive
[src]

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());

impl<'a, V> IntoCommonRefinementZip<'a, OrderedIntervalPartitions<usize>, ContiguousIntegerSet<usize>, HashMap<ContiguousIntegerSet<usize>, V, RandomState>> for CommonRefinementZipped<'a, OrderedIntervalPartitions<usize>, UsizeInterval, HashMap<UsizeInterval, V>>[src]

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

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

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

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

let m3: HashMap<UsizeInterval, i32> = vec![
    (UsizeInterval::new(2usize, 4), 7),
    (UsizeInterval::new(9usize, 10), -1),
    (UsizeInterval::new(15, 20), 0),
].into_iter().collect();

let mut iter = m1
    .common_refinement_zip(&m2, |a, b| a.get_start().cmp(&b.get_start()))
    .into_common_refinement_zip(&m3, |a, b| a.get_start().cmp(&b.get_start()))
    .into_iter();

assert_eq!(Some((UsizeInterval::new(0usize, 1), vec![Some(&5), None, None])), iter.next());
assert_eq!(Some((UsizeInterval::new(2usize, 3), vec![Some(&5), Some(&8), Some(&7)])), iter.next());
assert_eq!(Some((UsizeInterval::new(4usize, 4), vec![Some(&5), None, Some(&7)])), iter.next());
assert_eq!(Some((UsizeInterval::new(5usize, 8), vec![Some(&5), None, None])), iter.next());
assert_eq!(Some((UsizeInterval::new(9usize, 10), vec![Some(&5), None, Some(&-1)])), iter.next());
assert_eq!(Some((UsizeInterval::new(12usize, 14), vec![None, Some(&9), None])), iter.next());
assert_eq!(Some((UsizeInterval::new(15usize, 15), vec![None, Some(&9), Some(&0)])), iter.next());
assert_eq!(Some((UsizeInterval::new(16usize, 17), vec![Some(&21), Some(&9), Some(&0)])), iter.next());
assert_eq!(Some((UsizeInterval::new(18usize, 20), vec![None, Some(&9), Some(&0)])), iter.next());
assert_eq!(None, iter.next());

impl<'_, E> Sample<'_, ContiguousIntegerSetIter<E>, E, OrderedIntegerSet<E>> for ContiguousIntegerSet<E> where
    E: Integer + Copy + ToPrimitive
[src]

impl<'_, E> Slicing<&'_ ContiguousIntegerSet<E>, Option<ContiguousIntegerSet<E>>> for Range<usize> where
    E: Integer + Copy + FromPrimitive + ToPrimitive
[src]

impl<E: Integer + Copy> Set<E, Option<ContiguousIntegerSet<E>>> for ContiguousIntegerSet<E>[src]

impl<E: Integer + Copy + ToPrimitive> Finite for ContiguousIntegerSet<E>[src]

impl<E> Refineable<Vec<ContiguousIntegerSet<E>>> for ContiguousIntegerSet<E> where
    E: Integer + Copy + ToPrimitive
[src]

impl<E: Integer + Copy + Hash> SubsetIndexable<ContiguousIntegerSet<E>> for OrderedIntervalPartitions<E>[src]

impl<'_, E: Integer + Copy> ToIterator<'_, ContiguousIntegerSetIter<E>, E> for ContiguousIntegerSet<E>[src]

impl<E: Eq + Integer + Copy> Eq for ContiguousIntegerSet<E>[src]

impl<E: Clone + Integer + Copy> Clone for ContiguousIntegerSet<E>[src]

impl<E: PartialEq + Integer + Copy> PartialEq<ContiguousIntegerSet<E>> for ContiguousIntegerSet<E>[src]

impl<E: Integer + Copy> From<ContiguousIntegerSet<E>> for ContiguousIntegerSetIter<E>[src]

impl<E: Copy + Integer> Copy for ContiguousIntegerSet<E>[src]

impl<E: Hash + Integer + Copy> Hash for ContiguousIntegerSet<E>[src]

impl<'_, E: Integer + Copy + ToPrimitive> Sub<&'_ ContiguousIntegerSet<E>> for ContiguousIntegerSet<E>[src]

type Output = OrderedIntegerSet<E>

The resulting type after applying the - operator.

impl<E: Integer + Copy + ToPrimitive> Sub<ContiguousIntegerSet<E>> for ContiguousIntegerSet<E>[src]

type Output = OrderedIntegerSet<E>

The resulting type after applying the - operator.

impl<'_, E: Integer + Copy + ToPrimitive> Sub<&'_ ContiguousIntegerSet<E>> for OrderedIntegerSet<E>[src]

type Output = Self

The resulting type after applying the - operator.

impl<E: Integer + Copy + ToPrimitive> Sub<ContiguousIntegerSet<E>> for OrderedIntegerSet<E>[src]

type Output = Self

The resulting type after applying the - operator.

impl<'_, E: Integer + Copy + ToPrimitive> Sub<&'_ OrderedIntegerSet<E>> for ContiguousIntegerSet<E>[src]

type Output = OrderedIntegerSet<E>

The resulting type after applying the - operator.

impl<E: Integer + Copy + ToPrimitive> Sub<OrderedIntegerSet<E>> for ContiguousIntegerSet<E>[src]

type Output = OrderedIntegerSet<E>

The resulting type after applying the - operator.

impl<'_, E: Integer + Copy + ToPrimitive> SubAssign<&'_ ContiguousIntegerSet<E>> for OrderedIntegerSet<E>[src]

impl<E: Integer + Copy + ToPrimitive> SubAssign<ContiguousIntegerSet<E>> for OrderedIntegerSet<E>[src]

impl<E: Debug + Integer + Copy> Debug for ContiguousIntegerSet<E>[src]

Auto Trait Implementations

impl<E> Send for ContiguousIntegerSet<E> where
    E: Send

impl<E> Unpin for ContiguousIntegerSet<E> where
    E: Unpin

impl<E> Sync for ContiguousIntegerSet<E> where
    E: Sync

impl<E> UnwindSafe for ContiguousIntegerSet<E> where
    E: UnwindSafe

impl<E> RefUnwindSafe for ContiguousIntegerSet<E> where
    E: RefUnwindSafe

Blanket Implementations

impl<T> HasCardinality for T where
    T: Countable
[src]

impl<T> Countable for T where
    T: Finite
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,