Package apron

Class Interval

All Implemented Interfaces:
Serializable, Cloneable

public class Interval extends Coeff implements Cloneable, Serializable
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
    Modifier and Type
    Field
    Description
    (Mutable) lower bound.
    (Mutable) upper bound.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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).
    Interval(Mpq i, Mpq s)
    Creates an interval [i, s] with Mpq bounds (copied).
    Interval(Mpz i, Mpz s)
    Creates an interval [i, s] with Mpq bounds.
    Interval(Mpz inum, Mpz iden, Mpz snum, Mpz sden)
    Creates an interval [inum/iden, snum/sden] with Mpq bounds.
    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 Type
    Method
    Description
    Returns a copy of this.
    int
    Compares this and x for inclusion.
    int
    Compares this and x for inclusion.
    Creates a copy of the coefficient, of the same kind.
    int
    Returns a hash made from both bounds.
    inf()
    Returns a reference to the lower bound of this.
    boolean
    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
    Whether this represents a singleton.
    boolean
    Whether this represents [-oo, +oo].
    boolean
    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
    Sets the interval to [-oo, +oo], without changing the bound types.
    sup()
    Returns a reference to the upper bound of this.
    Returns a string representation of the interval.

    Methods inherited from class apron.Coeff

    create, equals

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • inf

      public Scalar inf
      (Mutable) lower bound.
    • sup

      public Scalar sup
      (Mutable) upper bound.
  • Constructor Details

    • Interval

      public Interval()
      Creates a new interval set to [0, 0], with double bounds.
    • Interval

      public Interval(Scalar i, Scalar s)
      Creates a new interval [i, s].

      The bounds are not copied, but only referenced.

    • Interval

      public Interval(Interval i)
      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

      public Interval(BigInteger i, BigInteger s)
      Creates an interval [i, s] with Mpq bounds.
    • Interval

      public Interval(BigInteger inum, BigInteger iden, BigInteger snum, BigInteger sden)
      Creates an interval [inum/iden, snum/sden] with Mpq bounds.
    • Interval

      public Interval(Mpz i, Mpz s)
      Creates an interval [i, s] with Mpq bounds.
    • Interval

      public Interval(Mpz inum, Mpz iden, Mpz snum, Mpz sden)
      Creates an interval [inum/iden, snum/sden] with Mpq bounds.
    • Interval

      public Interval(Mpq i, Mpq s)
      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

      public Interval(Mpfr i, Mpfr s)
      Creates an interval [i, s] with Mpfr bounds (copied).
  • Method Details

    • copy

      public Interval copy()
      Description copied from class: Coeff
      Creates a copy of the coefficient, of the same kind.
      Specified by:
      copy in class Coeff
    • setInf

      public void setInf(Scalar s)
      Sets the lower bound.
    • setSup

      public void setSup(Scalar s)
      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].
      Specified by:
      isZero in class Coeff
    • isLeq

      public boolean isLeq(Interval x)
      Whether this is included in x.
    • cmp

      public int cmp(Interval x)
      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

      public boolean isEqual(Interval x)
      Whether this and x are equal.
    • isEqual

      public boolean isEqual(int i)
      Whether this equals the singleton i.
      Specified by:
      isEqual in class Coeff
    • isScalar

      public boolean isScalar()
      Whether this represents a singleton.
      Specified by:
      isScalar in class Coeff
    • isEqual

      public boolean isEqual(Coeff x)
      Whether this equals x.
      Specified by:
      isEqual in class Coeff
    • cmp

      public int cmp(Coeff x)
      Compares this and x for inclusion.
      Specified by:
      cmp in class Coeff
      See Also:
    • neg

      public void neg()
      Negates x.
      Specified by:
      neg in class Coeff
    • inf

      public Scalar inf()
      Returns a reference to the lower bound of this.
      Specified by:
      inf in class Coeff
    • sup

      public Scalar sup()
      Returns a reference to the upper bound of this.
      Specified by:
      sup in class Coeff
    • toString

      public String toString()
      Returns a string representation of the interval.
      Specified by:
      toString in class Coeff
    • hashCode

      public int hashCode()
      Returns a hash made from both bounds.
      Specified by:
      hashCode in class Coeff
    • clone

      public Interval clone()
      Returns a copy of this.
      Overrides:
      clone in class Object