[][src]Trait math::set::traits::Refineable

pub trait Refineable<O> {
    pub fn get_common_refinement(&self, other: &Self) -> O;
}

Given two sets of the same type that are Refineable, their common refinement can be obtained

Required methods

pub fn get_common_refinement(&self, other: &Self) -> O[src]

Loading content...

Implementors

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

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

pub fn get_common_refinement(
    &self,
    other: &OrderedIntervalPartitions<E>
) -> OrderedIntervalPartitions<E>
[src]

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>>>()
);
Loading content...