Interface Range


public interface Range
An abstract representation of a set of Numbers. Each instance is typed: it is either a set of integers, or a set of reals. The two types are incompatible.
  • Method Details

    • isIntegral

      boolean isIntegral()
      Is this an integer set?
      Returns:
      true if this is a set of integers; false if this is a set of reals
    • isEmpty

      boolean isEmpty()
      Is this an empty set?
      Returns:
      true iff this is an empty set
    • isUniversal

      boolean isUniversal()
      Is this a universal set?
      Returns:
      true iff this is a universal set
    • containsNumber

      boolean containsNumber(Number number)
      Does this set contain the given number as a member?
      Parameters:
      number - any non-null Number of the same type (integer/real) as this set
      Returns:
      true iff this set contains the given number
    • contains

      boolean contains(Range set)
      Is this set a superset of the given one?
      Parameters:
      set - a number set of the same type (integer/real) as this one
      Returns:
      true iff this one contains the given one
    • intersects

      boolean intersects(Range set)
      Is the intersection of this set with the given one nonempty?
      Parameters:
      set - a number set of the same type (integer/real) as this one
      Returns:
      true iff the intersection of the two sets is nonempty
    • symbolicRepresentation

      BooleanExpression symbolicRepresentation(NumericExpression x, PreUniverse universe)
      Given a NumericExpression x, returns a BooleanExpression which holds iff x is in this Range.

      Example: suppose this Range is the Interval (0,1]. Given x, this method will return a BooleanExpression x>0 invalid input: '&'invalid input: '&' xinvalid input: '<'=1.

      Example: (0,1] U [4,5]. Given x, returns (x>0 invalid input: '&'invalid input: '&' xinvalid input: '<'=1) || (x>=4 invalid input: '&'invalid input: '&' xinvalid input: '<'=5).

      Parameters:
      x - variable to use in the new expression
      universe - symbolic universe used to construct the symbolic expression
      Returns:
      a BooleanExpression involving x which holds iff x is in this set
    • getSingletonValue

      Number getSingletonValue()
      If this range represents a singleton set (a set consisting of exactly one Number), this method returns the value of its sole element; otherwise, returns null.
      Returns:
      The exact Number represented by this Range, if this range represents a singleton number;
      otherwise, it will return null.
    • asInterval

      Interval asInterval()
      If this range is an interval, return the Interval representation, otherwise, returns null.
      Returns:
      The exact Interval represented by this Range, if this range represents a singleton interval;
      otherwise, it will return null.
    • sign

      Get the Range.RangeSign of this range.
      Returns:
    • intervalOverApproximation

      Interval intervalOverApproximation()
      Get the over-approximated Interval of this range. (E.g., for an integral range consisting of [-1, 0), [3, 6) and [6, 10); the actual range should be [-1, -1] U [3, 9]; and its over-approximation range should be [-1, 9].)
      Returns:
      the over-approximation Interval of this