pub struct OrderedIntervalPartitions<E: Integer + Copy> { /* private fields */ }
Implementations§
source§impl<E: Integer + Copy> OrderedIntervalPartitions<E>
impl<E: Integer + Copy> OrderedIntervalPartitions<E>
pub fn from_vec( partitions: Vec<ContiguousIntegerSet<E>> ) -> OrderedIntervalPartitions<E>
pub fn from_vec_with_trusted_order( partitions: Vec<ContiguousIntegerSet<E>> ) -> OrderedIntervalPartitions<E>
pub fn from_slice(slice: &[[E; 2]]) -> OrderedIntervalPartitions<E>
sourcepub fn num_partitions_overlapped_by(
&self,
other: &OrderedIntervalPartitions<E>
) -> usize
pub fn num_partitions_overlapped_by( &self, other: &OrderedIntervalPartitions<E> ) -> usize
returns the number of partitions that intersect with the other
’s
partitions
pub fn num_partitions(&self) -> usize
pub fn get_partitions_by_ref(&self) -> &Vec<ContiguousIntegerSet<E>>
pub fn into_vec(self) -> Vec<ContiguousIntegerSet<E>>
source§impl<E: Integer + Copy + ToPrimitive> OrderedIntervalPartitions<E>
impl<E: Integer + Copy + ToPrimitive> OrderedIntervalPartitions<E>
pub fn to_ordered_integer_set(&self) -> OrderedIntegerSet<E>
pub fn into_ordered_integer_set(self) -> OrderedIntegerSet<E>
source§impl<E: Integer + Copy + Hash> OrderedIntervalPartitions<E>
impl<E: Integer + Copy + Hash> OrderedIntervalPartitions<E>
sourcepub fn get_partition_containing(
&self,
subinterval: &ContiguousIntegerSet<E>
) -> Option<(usize, ContiguousIntegerSet<E>)>
pub fn get_partition_containing( &self, subinterval: &ContiguousIntegerSet<E> ) -> Option<(usize, ContiguousIntegerSet<E>)>
if there is a partition containing the subinterval, returns a tuple
(partition_index, partition)
Trait Implementations§
source§impl<E: Clone + Integer + Copy> Clone for OrderedIntervalPartitions<E>
impl<E: Clone + Integer + Copy> Clone for OrderedIntervalPartitions<E>
source§fn clone(&self) -> OrderedIntervalPartitions<E>
fn clone(&self) -> OrderedIntervalPartitions<E>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<E: PartialEq + Integer + Copy> PartialEq for OrderedIntervalPartitions<E>
impl<E: PartialEq + Integer + Copy> PartialEq for OrderedIntervalPartitions<E>
source§fn eq(&self, other: &OrderedIntervalPartitions<E>) -> bool
fn eq(&self, other: &OrderedIntervalPartitions<E>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<E: Integer + Copy> Refineable<OrderedIntervalPartitions<E>> for OrderedIntervalPartitions<E>
impl<E: Integer + Copy> Refineable<OrderedIntervalPartitions<E>> for OrderedIntervalPartitions<E>
source§fn get_common_refinement(
&self,
other: &OrderedIntervalPartitions<E>
) -> OrderedIntervalPartitions<E>
fn get_common_refinement( &self, other: &OrderedIntervalPartitions<E> ) -> OrderedIntervalPartitions<E>
Example
use math::{
partition::ordered_interval_partitions::OrderedIntervalPartitions,
set::{
contiguous_integer_set::ContiguousIntegerSet, traits::Refineable,
},
};
let p1 = OrderedIntervalPartitions::from_slice(&[[-1, 4], [8, 10]]);
let p2 = OrderedIntervalPartitions::from_slice(&[[3, 7]]);
assert_eq!(
p1.get_common_refinement(&p2).into_vec(),
[[-1, 2], [3, 4], [5, 7], [8, 10]]
.iter()
.map(|[a, b]| ContiguousIntegerSet::new(*a, *b))
.collect::<Vec<ContiguousIntegerSet<i32>>>()
);
source§impl<E: Integer + Copy + Hash> SubsetIndexable<ContiguousIntegerSet<E>, ContiguousIntegerSet<E>> for OrderedIntervalPartitions<E>
impl<E: Integer + Copy + Hash> SubsetIndexable<ContiguousIntegerSet<E>, ContiguousIntegerSet<E>> for OrderedIntervalPartitions<E>
fn get_set_containing( &self, subset: &ContiguousIntegerSet<E> ) -> Option<ContiguousIntegerSet<E>>
impl<E: Integer + Copy> StructuralPartialEq for OrderedIntervalPartitions<E>
Auto Trait Implementations§
impl<E> RefUnwindSafe for OrderedIntervalPartitions<E>where
E: RefUnwindSafe,
impl<E> Send for OrderedIntervalPartitions<E>where
E: Send,
impl<E> Sync for OrderedIntervalPartitions<E>where
E: Sync,
impl<E> Unpin for OrderedIntervalPartitions<E>where
E: Unpin,
impl<E> UnwindSafe for OrderedIntervalPartitions<E>where
E: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more