[−][src]Struct analytic::set::ordered_integer_set::ContiguousIntegerSet
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]
&'a self,
slicer: I
) -> Option<ContiguousIntegerSet<E>>
Trait Implementations
impl<E: Integer + Copy> Interval for ContiguousIntegerSet<E>[src]
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
fn coalesce_with(&self, other: &Self) -> Option<Self>[src]
impl<E: Integer + Copy> Coalesce<E> for ContiguousIntegerSet<E>[src]
fn coalesce_with(&self, other: &E) -> Option<Self>[src]
impl<E> CoalesceIntervals<ContiguousIntegerSet<E>, E> for OrderedIntegerSet<E> where
E: Integer + Copy + ToPrimitive, [src]
E: Integer + Copy + ToPrimitive,
fn to_coalesced_intervals(&self) -> Vec<ContiguousIntegerSet<E>>[src]
fn coalesce_intervals_inplace(&mut self)[src]
fn into_coalesced(self) -> Self[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]
&'a self,
other: &'a Self,
sort_fn: F
) -> CommonRefinementZipped<'a, OrderedIntervalPartitions<usize>, UsizeInterval, Self> where
F: FnMut(&UsizeInterval, &UsizeInterval) -> Ordering,
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]
self,
other: &'a HashMap<UsizeInterval, V>,
sort_fn: F
) -> CommonRefinementZipped<'a, OrderedIntervalPartitions<usize>, UsizeInterval, HashMap<UsizeInterval, V>> where
F: FnMut(&UsizeInterval, &UsizeInterval) -> Ordering,
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]
E: Integer + Copy + ToPrimitive,
fn sample_subset_without_replacement<'s: 'a>(
&'s self,
size: usize
) -> Result<O, String>[src]
&'s self,
size: usize
) -> Result<O, String>
fn sample_with_replacement<'s: 'a>(&'s self, size: usize) -> Result<O, String>[src]
impl<'_, E> Slicing<&'_ ContiguousIntegerSet<E>, Option<ContiguousIntegerSet<E>>> for Range<usize> where
E: Integer + Copy + FromPrimitive + ToPrimitive, [src]
E: Integer + Copy + FromPrimitive + ToPrimitive,
fn slice(
self,
input: &ContiguousIntegerSet<E>
) -> Option<ContiguousIntegerSet<E>>[src]
self,
input: &ContiguousIntegerSet<E>
) -> Option<ContiguousIntegerSet<E>>
impl<E: Integer + Copy> Set<E, Option<ContiguousIntegerSet<E>>> for ContiguousIntegerSet<E>[src]
fn is_empty(&self) -> bool[src]
fn contains(&self, item: E) -> bool[src]
fn intersect(
&self,
other: &ContiguousIntegerSet<E>
) -> Option<ContiguousIntegerSet<E>>[src]
&self,
other: &ContiguousIntegerSet<E>
) -> Option<ContiguousIntegerSet<E>>
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]
E: Integer + Copy + ToPrimitive,
fn get_common_refinement(
&self,
other: &ContiguousIntegerSet<E>
) -> IntegerIntervalRefinement<E>[src]
&self,
other: &ContiguousIntegerSet<E>
) -> IntegerIntervalRefinement<E>
impl<E: Integer + Copy + Hash> SubsetIndexable<ContiguousIntegerSet<E>> for OrderedIntervalPartitions<E>[src]
fn get_set_containing(
&self,
subset: &ContiguousIntegerSet<E>
) -> Option<ContiguousIntegerSet<E>>[src]
&self,
subset: &ContiguousIntegerSet<E>
) -> Option<ContiguousIntegerSet<E>>
impl<'_, E: Integer + Copy> ToIterator<'_, ContiguousIntegerSetIter<E>, E> for ContiguousIntegerSet<E>[src]
ⓘImportant traits for ContiguousIntegerSetIter<E>fn to_iter(&self) -> ContiguousIntegerSetIter<E>[src]
ⓘImportant traits for ContiguousIntegerSetIter<E>
impl<E: Eq + Integer + Copy> Eq for ContiguousIntegerSet<E>[src]
impl<E: Clone + Integer + Copy> Clone for ContiguousIntegerSet<E>[src]
fn clone(&self) -> ContiguousIntegerSet<E>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<E: PartialEq + Integer + Copy> PartialEq<ContiguousIntegerSet<E>> for ContiguousIntegerSet<E>[src]
fn eq(&self, other: &ContiguousIntegerSet<E>) -> bool[src]
fn ne(&self, other: &ContiguousIntegerSet<E>) -> bool[src]
impl<E: Integer + Copy> From<ContiguousIntegerSet<E>> for ContiguousIntegerSetIter<E>[src]
ⓘImportant traits for ContiguousIntegerSetIter<E>fn from(
contiguous_integer_set: ContiguousIntegerSet<E>
) -> ContiguousIntegerSetIter<E>[src]
ⓘImportant traits for ContiguousIntegerSetIter<E>
contiguous_integer_set: ContiguousIntegerSet<E>
) -> ContiguousIntegerSetIter<E>
impl<E: Copy + Integer> Copy for ContiguousIntegerSet<E>[src]
impl<E: Hash + Integer + Copy> Hash for ContiguousIntegerSet<E>[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl<'_, E: Integer + Copy + ToPrimitive> Sub<&'_ ContiguousIntegerSet<E>> for ContiguousIntegerSet<E>[src]
type Output = OrderedIntegerSet<E>
The resulting type after applying the - operator.
fn sub(self, rhs: &ContiguousIntegerSet<E>) -> Self::Output[src]
impl<E: Integer + Copy + ToPrimitive> Sub<ContiguousIntegerSet<E>> for ContiguousIntegerSet<E>[src]
type Output = OrderedIntegerSet<E>
The resulting type after applying the - operator.
fn sub(self, rhs: ContiguousIntegerSet<E>) -> Self::Output[src]
impl<'_, E: Integer + Copy + ToPrimitive> Sub<&'_ ContiguousIntegerSet<E>> for OrderedIntegerSet<E>[src]
type Output = Self
The resulting type after applying the - operator.
fn sub(self, rhs: &ContiguousIntegerSet<E>) -> Self::Output[src]
impl<E: Integer + Copy + ToPrimitive> Sub<ContiguousIntegerSet<E>> for OrderedIntegerSet<E>[src]
type Output = Self
The resulting type after applying the - operator.
fn sub(self, rhs: ContiguousIntegerSet<E>) -> Self::Output[src]
impl<'_, E: Integer + Copy + ToPrimitive> Sub<&'_ OrderedIntegerSet<E>> for ContiguousIntegerSet<E>[src]
type Output = OrderedIntegerSet<E>
The resulting type after applying the - operator.
fn sub(self, rhs: &OrderedIntegerSet<E>) -> Self::Output[src]
impl<E: Integer + Copy + ToPrimitive> Sub<OrderedIntegerSet<E>> for ContiguousIntegerSet<E>[src]
type Output = OrderedIntegerSet<E>
The resulting type after applying the - operator.
fn sub(self, rhs: OrderedIntegerSet<E>) -> Self::Output[src]
impl<'_, E: Integer + Copy + ToPrimitive> SubAssign<&'_ ContiguousIntegerSet<E>> for OrderedIntegerSet<E>[src]
fn sub_assign(&mut self, rhs: &ContiguousIntegerSet<E>)[src]
impl<E: Integer + Copy + ToPrimitive> SubAssign<ContiguousIntegerSet<E>> for OrderedIntegerSet<E>[src]
fn sub_assign(&mut self, rhs: ContiguousIntegerSet<E>)[src]
impl<E: Debug + Integer + Copy> Debug for ContiguousIntegerSet<E>[src]
Auto Trait Implementations
impl<E> Send for ContiguousIntegerSet<E> where
E: Send,
E: Send,
impl<E> Unpin for ContiguousIntegerSet<E> where
E: Unpin,
E: Unpin,
impl<E> Sync for ContiguousIntegerSet<E> where
E: Sync,
E: Sync,
impl<E> UnwindSafe for ContiguousIntegerSet<E> where
E: UnwindSafe,
E: UnwindSafe,
impl<E> RefUnwindSafe for ContiguousIntegerSet<E> where
E: RefUnwindSafe,
E: RefUnwindSafe,
Blanket Implementations
impl<T> HasCardinality for T where
T: Countable, [src]
T: Countable,
fn get_cardinality(&Self) -> Cardinality[src]
impl<T> Countable for T where
T: Finite, [src]
T: Finite,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,