[−][src]Struct intspan::IntSpan
Methods
impl IntSpan
[src]
INTERFACE: Set creation and contents
pub fn new() -> Self
[src]
pub fn from(runlist: &str) -> Self
[src]
pub fn from_pair(lower: i32, upper: i32) -> Self
[src]
pub fn get_neg_inf(&self) -> i32
[src]
pub fn get_pos_inf(&self) -> i32
[src]
pub fn clear(&mut self)
[src]
pub fn edge_size(&self) -> usize
[src]
pub fn span_size(&self) -> usize
[src]
pub fn to_vec(&self) -> Vec<i32>
[src]
pub fn ranges(&self) -> Vec<i32>
[src]
pub fn contains(&self, n: i32) -> bool
[src]
pub fn min(&self) -> i32
[src]
pub fn max(&self) -> i32
[src]
impl IntSpan
[src]
INTERFACE: Set cardinality
pub fn cardinality(&self) -> i32
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn is_neg_inf(&self) -> bool
[src]
pub fn is_pos_inf(&self) -> bool
[src]
pub fn is_infinite(&self) -> bool
[src]
pub fn is_finite(&self) -> bool
[src]
pub fn is_universal(&self) -> bool
[src]
impl IntSpan
[src]
INTERFACE: Member operations (mutate original set)
pub fn add_pair(&mut self, lower: i32, upper: i32)
[src]
pub fn add_n(&mut self, n: i32)
[src]
pub fn add_ranges(&mut self, ranges: &[i32])
[src]
pub fn merge(&mut self, other: &Self)
[src]
pub fn add_vec(&mut self, ints: &[i32])
[src]
pub fn add_runlist(&mut self, runlist: &str)
[src]
pub fn invert(&mut self)
[src]
pub fn remove_pair(&mut self, lower: i32, upper: i32)
[src]
pub fn remove_n(&mut self, n: i32)
[src]
pub fn remove_ranges(&mut self, ranges: &[i32])
[src]
pub fn subtract(&mut self, other: &Self)
[src]
pub fn remove_vec(&mut self, ints: &[i32])
[src]
pub fn remove_runlist(&mut self, runlist: &str)
[src]
impl IntSpan
[src]
INTERFACE: Set binary operations (create new set)
pub fn copy(&self) -> Self
[src]
pub fn union(&self, other: &Self) -> Self
[src]
pub fn complement(&self) -> Self
[src]
pub fn diff(&self, other: &Self) -> Self
[src]
pub fn intersect(&self, other: &Self) -> Self
[src]
pub fn xor(&self, other: &Self) -> Self
[src]
impl IntSpan
[src]
INTERFACE: Set relations
pub fn equals(&self, other: &Self) -> bool
[src]
pub fn subset(&self, other: &Self) -> bool
[src]
pub fn superset(&self, other: &Self) -> bool
[src]
impl IntSpan
[src]
INTERFACE: Indexing
impl IntSpan
[src]
INTERFACE: Spans Ops
pub fn cover(&self) -> Self
[src]
pub fn holes(&self) -> Self
[src]
pub fn inset(&self, n: i32) -> Self
[src]
pub fn trim(&self, n: i32) -> Self
[src]
pub fn pad(&self, n: i32) -> Self
[src]
pub fn excise(&self, min_len: i32) -> Self
[src]
pub fn fill(&self, max_len: i32) -> Self
[src]
impl IntSpan
[src]
INTERFACE: Inter-set OPs
pub fn overlap(&self, other: &Self) -> i32
[src]
overlap
Returns the size of intersection of two sets.
set.overlap(&other)
equivalent to set.intersect(&other).cardinality()
let set = IntSpan::from("1"); let other = IntSpan::from("1"); assert_eq!(set.overlap(&other), 1); let other = IntSpan::from("2"); assert_eq!(set.overlap(&other), 0); let set = IntSpan::from("1-5"); let other = IntSpan::from("1-10"); assert_eq!(set.overlap(&other), 5); let set = IntSpan::from("1-5,6"); let other = IntSpan::from("6-10"); assert_eq!(set.overlap(&other), 1);
pub fn distance(&self, other: &Self) -> i32
[src]
Returns the distance between sets, measured as follows.
-
If the sets overlap, then the distance is negative and given by
- set.overlap(&other)
-
If the sets do not overlap, $d is positive and given by the distance on the integer line between the two closest islands of the sets.
let set = IntSpan::from("1"); let other = IntSpan::from("1"); assert_eq!(set.distance(&other), -1); let other = IntSpan::from(""); assert_eq!(set.distance(&other), 0); let other = IntSpan::from("2"); assert_eq!(set.distance(&other), 1); let set = IntSpan::from("1-5"); let other = IntSpan::from("1-10"); assert_eq!(set.distance(&other), -5); let other = IntSpan::from("10-15"); assert_eq!(set.distance(&other), 5); let set = IntSpan::from("1-5,6"); let other = IntSpan::from("6-10"); assert_eq!(set.distance(&other), -1); let set = IntSpan::from("1-5,10-15"); let other = IntSpan::from("5-9"); assert_eq!(set.distance(&other), -1); let other = IntSpan::from("6"); assert_eq!(set.distance(&other), 1); let other = IntSpan::from("7"); assert_eq!(set.distance(&other), 2); let other = IntSpan::from("7-9"); assert_eq!(set.distance(&other), 1); let other = IntSpan::from("16-20"); assert_eq!(set.distance(&other), 1); let other = IntSpan::from("17-20"); assert_eq!(set.distance(&other), 2);
impl IntSpan
[src]
INTERFACE: Aliases
pub fn size(&self) -> i32
[src]
pub fn runlist(&self) -> String
[src]
pub fn elements(&self) -> Vec<i32>
[src]
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for IntSpan
impl Send for IntSpan
impl Sync for IntSpan
impl Unpin for IntSpan
impl UnwindSafe for IntSpan
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,