An Interval is defined by its minimum and maximum values, where min <= max.
This implementation offers basic interval arithmetic operations like addition, subtraction, multiplication and division. Operations always return a new interval and will not modify the existing ones. Additionally this class implementions comparison relations for intervals.
This implementation (partly) supports unbounded intervals with borders at +/- infinity and empty sets.
Operator and comparison definitions are based on: Bohlender, Gerd, and Ulrich Kulisch. 2010. "Definition of the Arithmetic Operations and Comparison Relations for an Interval Arithmetic Standard". Reliable Computing 15 (1): 36–42.
Note: This implementation does not offer a complete set of operations yet:
- No handling of unbounded intervals in operators.
- No proper rounding.
- Implements
-
- Comparable
Constructors
- Interval(num min, num max)
-
Creates a new interval with given borders.…
- Interval.empty()
-
Returns an immutable empty set.
factory
Properties
- hashCode → int
-
read-only
- max → num
-
Interval borders.
read / write - min → num
-
Interval borders.
read / write - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator *(
Interval i) → dynamic -
Performs an interval multiplication.…
-
operator +(
Interval i) → dynamic -
Performs an interval addition.…
-
operator -(
Interval i) → dynamic -
Performs an interval subtraction.…
-
operator /(
Interval i) → dynamic -
Performs an interval division.…
-
operator <(
Interval i) → dynamic -
Less than operator on intervals.…
-
operator <=(
Interval i) → dynamic -
Less or equal than operator on intervals.…
-
operator ==(
Interval i) → dynamic -
Equals operator on intervals.…
-
operator >(
Interval i) → dynamic -
Greater than operator on intervals.…
-
operator >=(
Interval i) → dynamic -
Greater or equal than operator on intervals.…
-
operator unary-(
) → dynamic -
Unary minus on intervals.…
Methods
-
compareTo(
Comparable other) → int -
Compares this object to another
Comparable
… -
contains(
num element) → bool -
Element-of relation. Returns true, if given element is included in this interval. Defined on a real number i and an interval:…
-
containsZero(
) → bool -
Returns true, if this interval contains zero (min <= 0 <= max).
-
glb(
Interval i) → Interval -
Returns the greatest lower bound.
-
includes(
Interval i) → bool -
Inclusion relation. Returns true, if the given interval is included in this interval.…
-
isBound(
) → bool -
Returns true, if neither min or max values are infinite.
-
isEmpty(
) → bool -
Returns true, if this is the empty set.
-
isPositive(
) → bool -
Returns true, if this interval is positive (min >= 0)
-
length(
) → num -
Returns the length of this interval.
-
lub(
Interval i) → Interval -
Returns the least upper bound.
-
noSuchMethod(
Invocation invocation) → dynamic -
noSuchMethod
is invoked when users invoke a non-existent method on an object. The name of the method and the arguments of the invocation are passed tonoSuchMethod
in anInvocation
. IfnoSuchMethod
returns a value, that value becomes the result of the original invocation.…inherited -
toString(
) → String -
Returns a string representation of this object.