Struct honestintervals::IntervalSet
[−]
[src]
pub struct IntervalSet<BOUND: PartialEq + PartialOrd> { pub intervals: Vec<Interval<BOUND>>, }
Interval set struct.
Represents a set of non-intersecting intervals.
Fields
intervals: Vec<Interval<BOUND>>
Non-intersecting intervals in strictly ascending order.
Methods
impl<BOUND: Float> IntervalSet<BOUND>
[src]
fn new(lo: BOUND, hi: BOUND) -> Self
Constructs an interval set of one interval from given bounds.
The result may be empty if both bounds are NaN.
fn from_interval(i: Interval<BOUND>) -> Self
Constructs an interval set of one interval from given interval.
The result may be empty if the interval is NaN.
fn from_intervals(intervals: Vec<Interval<BOUND>>) -> Self
Constructs an interval set from given intervals.
The intervals will be sorted and the intersecting intervals will be merged.
fn singleton(val: BOUND) -> Self
Constructs an interval set of one singleton interval.
The result may be empty if the value is NaN.
fn zero(precision: usize) -> Self
Constructs an interval set of one interval containing only zero.
fn one(precision: usize) -> Self
Constructs an interval set of one interval containing only one.
fn empty() -> Self
Constructs an empty interval set.
fn whole(precision: usize) -> Self
Constructs an interval set of one interval containing all numbers.
fn from_with_prec(val: f64, precision: usize) -> Self
Constructs an interval set from a float with given precision.
fn from_str_with_prec(
s: &str,
precision: usize
) -> Result<Self, ParseIntervalSetError>
s: &str,
precision: usize
) -> Result<Self, ParseIntervalSetError>
Constructs an interval set by parsing a string.
Accepts INTERVAL_SET
according to the rule below.
INTERVAL_SET = INTERVAL | '{' ( INTERVAL ( ';' INTERVAL )* )? '}'
fn is_singleton(&self) -> bool
Whether self
contains only one interval that is singleton.
fn is_zero(&self) -> bool
Whether self
contains only one interval that contains only zero.
fn is_empty(&self) -> bool
Whether self
is empty.
fn has_zero(&self) -> bool
Whether self
contains an interval that contains zero.
fn binary_op<OP>(self, rhs: Self, op: OP) -> Self where
OP: Fn(Interval<BOUND>, Interval<BOUND>) -> Vec<Interval<BOUND>>,
OP: Fn(Interval<BOUND>, Interval<BOUND>) -> Vec<Interval<BOUND>>,
Performs a binary operation by performing it on all pairs of intervals of self
and rhs
.
Trait Implementations
impl<BOUND: Clone + PartialEq + PartialOrd> Clone for IntervalSet<BOUND>
[src]
fn clone(&self) -> IntervalSet<BOUND>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<BOUND: Debug + PartialEq + PartialOrd> Debug for IntervalSet<BOUND>
[src]
impl<BOUND: Float> From<f64> for IntervalSet<BOUND>
[src]
impl<BOUND: Float> FromStr for IntervalSet<BOUND>
[src]
type Err = ParseIntervalSetError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, ParseIntervalSetError>
Parses a string s
to return a value of this type. Read more
impl<BOUND: Float> Display for IntervalSet<BOUND>
[src]
impl<BOUND: Float> Into<Vec<(BOUND, BOUND)>> for IntervalSet<BOUND>
[src]
impl<BOUND: Float> PartialEq for IntervalSet<BOUND>
[src]
fn eq(&self, rhs: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<BOUND: Float> Neg for IntervalSet<BOUND>
[src]
type Output = Self
The resulting type after applying the -
operator
fn neg(self) -> Self::Output
The method for the unary -
operator
impl<BOUND: Float> Add<Self> for IntervalSet<BOUND>
[src]
type Output = Self
The resulting type after applying the +
operator
fn add(self, other: Self) -> Self::Output
The method for the +
operator
impl<BOUND: Float> Sub<Self> for IntervalSet<BOUND>
[src]
type Output = Self
The resulting type after applying the -
operator
fn sub(self, other: Self) -> Self::Output
The method for the -
operator
impl<BOUND: Float> Mul<Self> for IntervalSet<BOUND>
[src]
type Output = Self
The resulting type after applying the *
operator
fn mul(self, other: Self) -> Self::Output
The method for the *
operator
impl<BOUND: Float> Div<Self> for IntervalSet<BOUND>
[src]
type Output = Self
The resulting type after applying the /
operator
fn div(self, other: Self) -> Self::Output
The method for the /
operator