Package apron
Class Interval
java.lang.Object
apron.Coeff
apron.Interval
- All Implemented Interfaces:
Serializable
,Cloneable
Class of intervals of reals, denoted by a lower and an upper
Scalar
bound.
Intervals are a specialisation of the more general Coeff
class.
Intervals may be unbounded (one or both bound(s) can be infinite). An interval can also be empty (the canonical empty interval is [1, -1]).
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInterval()
Creates a new interval set to [0, 0], with double bounds.Interval
(double i, double s) Creates an interval [i, s] with double bounds.Interval
(int i, int s) Creates an interval [i, s] with Mpq bounds.Interval
(int inum, int iden, int snum, int sden) Creates an interval [inum/iden, snum/sden] with Mpq bounds.Creates a copy of the interval i.Creates a new interval [i, s].Creates an interval [i, s] with Mpfr bounds (copied).Creates an interval [i, s] with Mpq bounds (copied).Creates an interval [i, s] with Mpq bounds.Creates an interval [inum/iden, snum/sden] with Mpq bounds.Interval
(BigInteger i, BigInteger s) Creates an interval [i, s] with Mpq bounds.Interval
(BigInteger inum, BigInteger iden, BigInteger snum, BigInteger sden) Creates an interval [inum/iden, snum/sden] with Mpq bounds. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a copy of this.int
Compares this and x for inclusion.int
Compares this and x for inclusion.copy()
Creates a copy of the coefficient, of the same kind.int
hashCode()
Returns a hash made from both bounds.inf()
Returns a reference to the lower bound of this.boolean
isBottom()
Whether this represents an empty interval.boolean
isEqual
(int i) Whether this equals the singleton i.boolean
Whether this equals x.boolean
Whether this and x are equal.boolean
Whether this is included in x.boolean
isScalar()
Whether this represents a singleton.boolean
isTop()
Whether this represents [-oo, +oo].boolean
isZero()
Whether this represents the singleton [0, 0].void
neg()
Negates x.void
Sets the interval to [1, -1], without changing the bound types.void
Sets the lower bound.void
Sets the upper bound.void
setTop()
Sets the interval to [-oo, +oo], without changing the bound types.sup()
Returns a reference to the upper bound of this.toString()
Returns a string representation of the interval.
-
Field Details
-
inf
(Mutable) lower bound. -
sup
(Mutable) upper bound.
-
-
Constructor Details
-
Interval
public Interval()Creates a new interval set to [0, 0], with double bounds. -
Interval
Creates a new interval [i, s].The bounds are not copied, but only referenced.
-
Interval
Creates a copy of the interval i.Both scalar bounds are copied.
-
Interval
public Interval(int i, int s) Creates an interval [i, s] with Mpq bounds. -
Interval
public Interval(int inum, int iden, int snum, int sden) Creates an interval [inum/iden, snum/sden] with Mpq bounds. -
Interval
Creates an interval [i, s] with Mpq bounds. -
Interval
Creates an interval [inum/iden, snum/sden] with Mpq bounds. -
Interval
Creates an interval [i, s] with Mpq bounds. -
Interval
Creates an interval [inum/iden, snum/sden] with Mpq bounds. -
Interval
Creates an interval [i, s] with Mpq bounds (copied). -
Interval
public Interval(double i, double s) Creates an interval [i, s] with double bounds. -
Interval
Creates an interval [i, s] with Mpfr bounds (copied).
-
-
Method Details
-
copy
Description copied from class:Coeff
Creates a copy of the coefficient, of the same kind. -
setInf
Sets the lower bound. -
setSup
Sets the upper bound. -
setTop
public void setTop()Sets the interval to [-oo, +oo], without changing the bound types. -
setBottom
public void setBottom()Sets the interval to [1, -1], without changing the bound types. -
isTop
public boolean isTop()Whether this represents [-oo, +oo]. -
isBottom
public boolean isBottom()Whether this represents an empty interval. -
isZero
public boolean isZero()Whether this represents the singleton [0, 0]. -
isLeq
Whether this is included in x. -
cmp
Compares this and x for inclusion.- Returns:
- 0 is this = x, -1 if this is included in x, +1 if this contains x, -2 if the lower bound of this is smaller than that of x, +2 if the lower bound of this is greater than that of x.
-
isEqual
Whether this and x are equal. -
isEqual
public boolean isEqual(int i) Whether this equals the singleton i. -
isScalar
public boolean isScalar()Whether this represents a singleton. -
isEqual
Whether this equals x. -
cmp
Compares this and x for inclusion. -
neg
public void neg()Negates x. -
inf
Returns a reference to the lower bound of this. -
sup
Returns a reference to the upper bound of this. -
toString
Returns a string representation of the interval. -
hashCode
public int hashCode()Returns a hash made from both bounds. -
clone
Returns a copy of this.
-