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.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumA categorization of ranges based on their relationship to 0. -
Method Summary
Modifier and TypeMethodDescriptionIf this range is an interval, return the Interval representation, otherwise, returnsnull.booleanIs this set a superset of the given one?booleancontainsNumber(Number number) Does this set contain the given number as a member?If this range represents a singleton set (a set consisting of exactly one Number), this method returns the value of its sole element; otherwise, returnsnull.booleanintersects(Range set) Is the intersection of this set with the given one nonempty?Get the over-approximatedIntervalofthisrange.booleanisEmpty()Is this an empty set?booleanIs this an integer set?booleanIs this a universal set?sign()Get theRange.RangeSignofthisrange.symbolicRepresentation(NumericExpression x, PreUniverse universe)
-
Method Details
-
isIntegral
boolean isIntegral()Is this an integer set?- Returns:
trueif this is a set of integers;falseif this is a set of reals
-
isEmpty
boolean isEmpty()Is this an empty set?- Returns:
trueiff this is an empty set
-
isUniversal
boolean isUniversal()Is this a universal set?- Returns:
trueiff this is a universal set
-
containsNumber
Does this set contain the given number as a member?- Parameters:
number- any non-nullNumberof the same type (integer/real) as this set- Returns:
trueiff this set contains the given number
-
contains
Is this set a superset of the given one?- Parameters:
set- a number set of the same type (integer/real) as this one- Returns:
trueiff this one contains the given one
-
intersects
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:
trueiff the intersection of the two sets is nonempty
-
symbolicRepresentation
Given aNumericExpressionx, returns aBooleanExpressionwhich holds iffxis inthisRange.Example: suppose
thisRangeis theInterval(0,1]. Givenx, this method will return aBooleanExpressionx>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 expressionuniverse- symbolic universe used to construct the symbolic expression- Returns:
- a
BooleanExpressioninvolvingxwhich holds iffxis 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, returnsnull. -
asInterval
Interval asInterval()If this range is an interval, return the Interval representation, otherwise, returnsnull. -
sign
Range.RangeSign sign()Get theRange.RangeSignofthisrange.- Returns:
-
intervalOverApproximation
Interval intervalOverApproximation()Get the over-approximatedIntervalofthisrange. (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
Intervalofthis
-