pub struct OrderedIntervalPartitions<E: Integer + Copy> { /* private fields */ }

Implementations§

source§

impl<E: Integer + Copy> OrderedIntervalPartitions<E>

source

pub fn from_vec( partitions: Vec<ContiguousIntegerSet<E>> ) -> OrderedIntervalPartitions<E>

source

pub fn from_vec_with_trusted_order( partitions: Vec<ContiguousIntegerSet<E>> ) -> OrderedIntervalPartitions<E>

source

pub fn from_slice(slice: &[[E; 2]]) -> OrderedIntervalPartitions<E>

source

pub fn num_partitions_overlapped_by( &self, other: &OrderedIntervalPartitions<E> ) -> usize

returns the number of partitions that intersect with the other’s partitions

source

pub fn num_partitions(&self) -> usize

source

pub fn get_partitions_by_ref(&self) -> &Vec<ContiguousIntegerSet<E>>

source

pub fn into_vec(self) -> Vec<ContiguousIntegerSet<E>>

source§

impl<E: Integer + Copy + ToPrimitive> OrderedIntervalPartitions<E>

source§

impl<E: Integer + Copy + Hash> OrderedIntervalPartitions<E>

source

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>

source§

fn clone(&self) -> OrderedIntervalPartitions<E>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<E: Debug + Integer + Copy> Debug for OrderedIntervalPartitions<E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<E: PartialEq + Integer + Copy> PartialEq for OrderedIntervalPartitions<E>

source§

fn eq(&self, other: &OrderedIntervalPartitions<E>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<E: Integer + Copy> Refineable<OrderedIntervalPartitions<E>> for OrderedIntervalPartitions<E>

source§

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>

source§

impl<E: Integer + Copy> StructuralPartialEq for OrderedIntervalPartitions<E>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V