public interface RangeFactory
Factory for producing instances of
Range.-
Method Summary
Modifier and TypeMethodDescriptionaffineTransform(Range range, Number a, Number b) complement(Range range) Return the complementRangeof the inputrange.emptySet(boolean isIntegral) Returns an emptyRangeof the specified type (integer/real) with no interval contained.Returns aRangeR such that the intersection of R and C=contextRangeis I=rangeand R is "as simple as possible".Returns aRangeconsisting of exactly one interval representing all x between theNumberlower(exclusively iffstrictLoweristrue, else inclusively) and theNumberupper(exclusively iffstrictUpperistrue, else inclusively).
Preconditions:
> All arguments should satisfy the preconditions ofInterval.
Postconditions:
> The generated interval instance should satisfy the postconditions ofInterval.power(Range range, IntegerNumber exp) singletonSet(Number number) universalSet(boolean isIntegral) Returns a range of either integer or real type.
-
Method Details
-
emptySet
Returns an emptyRangeof the specified type (integer/real) with no interval contained.- Parameters:
isIntegral- is this the integer type (not real type)?- Returns:
- an empty
Rangeas described.
-
singletonSet
-
interval
Range interval(boolean isIntegral, Number lower, boolean strictLower, Number upper, boolean strictUpper) Returns aRangeconsisting of exactly one interval representing all x between theNumberlower(exclusively iffstrictLoweristrue, else inclusively) and theNumberupper(exclusively iffstrictUpperistrue, else inclusively).
Preconditions:
> All arguments should satisfy the preconditions ofInterval.
Postconditions:
> The generated interval instance should satisfy the postconditions ofInterval.- Parameters:
isIntegral- does the interval have integer type (as opposed to real type)?lower- the lower bound of the returnedRangewith the type defined byisIntegralstrictLower- is the lower bound strict? (i.e., "(" if exclusive, as opposed to "[" if inclusive)upper- the upper bound of the returnedRangewith the type defined byisIntegralstrictUpper- is the upper bound strict? (i.e., ")" if exclusive, as opposed to "]" if inclusive)- Returns:
- an interval
Rangeas described.
-
complement
-
union
Return the unionRangeofrange0andrange1. In other words, the returnedRangecontains all x, where x is contained in eitherrange0orrange1.The type of returnedRangeis same with two input ranges. Preconditions:
> Therange0andrange1must be non-null.
> Therange0andrange1must have a same type (integer/real) -
intersect
Return the intersectionRangeofrange0andrange1. In other words, the returnedRangecontains all x, where x is contained in both input ranges.The type of returnedRangeis same with two input ranges. Preconditions:
> Therange0andrange1must be non-null.
> Therange0andrange1must have a same type (integer/real) -
add
-
setMinus
Return the differenceRangeofrange0andrange1. In other words, the returnedRangecontains all x, where x is contained inrange0but not inrange1.The type of returnedRangeis same with two input ranges. Preconditions:
> Therange0andrange1must be non-null.
> Therange0andrange1must have a same type (integer/real) -
multiply
-
subtract
-
power
-
power
Return aRangecontaining all x^exp, where x is inrangeandexpis anIntegerNumber. The type of returnedRangeis same with the inputrange. Preconditions:
> Therangeandexpsmust be non-null.
> Theexpmust be a finite non-negativeIntegerNumber.- Parameters:
range- a non-nullRangeexp- anIntegerNumberas the exponent- Returns:
- a
Rangeas described.
-
affineTransform
-
divide
Return aRangecontaining all x/constant, where x is inrangeandconstantis a non-nulland non-zero finiteNumber. The type of returnedRangeis same with the inputrange. Preconditions:
> Therangeandconstantmust be non-null.
> Therangeandconstantmust have a same type (integer/real)
> Theconstantmust be non-null, non-zero and finite. -
divide
-
multiply
Return aRangecontaining all x*constant, where x is inrangeandconstantis a non-nullfiniteNumber. The type of returnedRangeis same with the inputrange. Preconditions:
> Therangeandconstantmust be non-null.
> Therangeandconstantmust have a same type (integer/real)
> Theconstantmust be non-nulland finite. -
add
Return aRangecontaining all x+constant, where x is inrangeandconstantis a non-nullfiniteNumber. The type of returnedRangeis same with the inputrange. Preconditions:
> Therangeandconstantmust be non-null.
> Therangeandconstantmust have a same type (integer/real)
> Theconstantmust be non-nulland finite. -
subtract
Return aRangecontaining all x-constant, where x is inrangeandconstantis a non-nullfiniteNumber. The type of returnedRangeis same with the inputrange. Preconditions:
> Therangeandconstantmust be non-null.
> Therangeandconstantmust have a same type (integer/real)
> Theconstantmust be non-nulland finite. -
newRange
Create a newRangebased on given non-nullIntervals.
If the given intervals represents an empty interval array, this function will return an emptyRangewith 0 interval. (i.e., zero would be the size of the interval array stored inthisRange) Preconditions:
> All givenintervalsmust be non-null.
> All givenintervalsmust have a same type.
Postconditions:
> All intervals stored in the returned result will be simplified. -
universalSet
Returns a range of either integer or real type. That is, the set consisting of all real numbers, or the set consisting of all integers.- Parameters:
isIntegral- is this the integer type (not real type)?
-
expand
Returns aRangeR such that the intersection of R and C=contextRangeis I=rangeand R is "as simple as possible". Precondition: I is contained in C. I and C have the same type. Postcondition: R intersect C = I.- Parameters:
range- a range to be expandedcontextRange- the background context assumed to be true- Returns:
- a range R satisfying R intersect C = I
-