Interface RangeFactory


public interface RangeFactory
Factory for producing instances of Range.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Range range, Number constant)
    Return a Range containing all x+constant, where x is in range and constant is a non- null finite Number.
    add(Range range0, Range range1)
    Return a Range containing all x+y, where x is in range0 and y is in range1.
    Return a Range containing all x*a+b, where x is in range, a and b are Numbers.
    Return the complement Range of the input range.
    divide(Range range, Number constant)
    Return a Range containing all x/constant, where x is in range and constant is a non- null and non-zero finite Number.
    divide(Range range0, Range range1)
    Return a Range containing all x/y, where x is in range0 and y is is in range1.
    emptySet(boolean isIntegral)
    Returns an empty Range of the specified type (integer/real) with no interval contained.
    expand(Range range, Range contextRange)
    Returns a Range R such that the intersection of R and C= contextRange is I=range and R is "as simple as possible".
    intersect(Range range0, Range range1)
    Return the intersection Range of range0 and range1.
    interval(boolean isIntegral, Number lower, boolean strictLower, Number upper, boolean strictUpper)
    Returns a Range consisting of exactly one interval representing all x between the Number lower (exclusively iff strictLower is true, else inclusively) and the Number upper (exclusively iff strictUpper is true, else inclusively).
    Preconditions:
    > All arguments should satisfy the preconditions of Interval.
    Postconditions:
    > The generated interval instance should satisfy the postconditions of Interval.
    multiply(Range range, Number constant)
    Return a Range containing all x*constant, where x is in range and constant is a non- null finite Number.
    multiply(Range range0, Range range1)
    Return a Range containing all x*y, where x is in range0 and y is in range1.
    newRange(Interval... intervals)
    Create a new Range based on given non-null Intervals.
    If the given intervals represents an empty interval array, this function will return an empty Range with 0 interval.
    power(Range range, int exp)
    Return a Range containing all x^exp, where x is in range and exp is a natural numbers.
    power(Range range, IntegerNumber exp)
    Return a Range containing all x^exp, where x is in range and exp is an IntegerNumber.
    setMinus(Range range0, Range range1)
    Return the difference Range of range0 and range1.
    Returns a Range consisting of exactly one interval representing the single specified Number number.
    The type of number determines the type of returned Range.
    Preconditions:
    > The number must be non-null and infinite.
    subtract(Range range, Number constant)
    Return a Range containing all x-constant, where x is in range and constant is a non- null finite Number.
    subtract(Range range0, Range range1)
    Return a Range containing all x-y, where x is in range0 and y is in range1.
    union(Range range0, Range range1)
    Return the union Range of range0 and range1.
    universalSet(boolean isIntegral)
    Returns a range of either integer or real type.
  • Method Details

    • emptySet

      Range emptySet(boolean isIntegral)
      Returns an empty Range of the specified type (integer/real) with no interval contained.
      Parameters:
      isIntegral - is this the integer type (not real type)?
      Returns:
      an empty Range as described.
    • singletonSet

      Range singletonSet(Number number)
      Returns a Range consisting of exactly one interval representing the single specified Number number.
      The type of number determines the type of returned Range.
      Preconditions:
      > The number must be non-null and infinite.
      Parameters:
      number - a non-null finite Number
      Returns:
      a singleton Range as described.
    • interval

      Range interval(boolean isIntegral, Number lower, boolean strictLower, Number upper, boolean strictUpper)
      Returns a Range consisting of exactly one interval representing all x between the Number lower (exclusively iff strictLower is true, else inclusively) and the Number upper (exclusively iff strictUpper is true, else inclusively).
      Preconditions:
      > All arguments should satisfy the preconditions of Interval.
      Postconditions:
      > The generated interval instance should satisfy the postconditions of Interval.
      Parameters:
      isIntegral - does the interval have integer type (as opposed to real type)?
      lower - the lower bound of the returned Range with the type defined by isIntegral
      strictLower - is the lower bound strict? (i.e., "(" if exclusive, as opposed to "[" if inclusive)
      upper - the upper bound of the returned Range with the type defined by isIntegral
      strictUpper - is the upper bound strict? (i.e., ")" if exclusive, as opposed to "]" if inclusive)
      Returns:
      an interval Range as described.
    • complement

      Range complement(Range range)
      Return the complement Range of the input range. In other words, the returned Range contains all x, where x is not in the input range. The type of returned Range is same with the input range.
      Preconditions:
      > The input range must be non-null.
      Parameters:
      range - the input Range
      Returns:
      a Range as described.
    • union

      Range union(Range range0, Range range1)
      Return the union Range of range0 and range1. In other words, the returned Range contains all x, where x is contained in either range0 or range1.The type of returned Range is same with two input ranges. Preconditions:
      > The range0 and range1 must be non- null.
      > The range0 and range1 must have a same type (integer/real)
      Parameters:
      range0 - a non-null Range
      range1 - a non-null Range of the same type (integer/real) as range0.
      Returns:
      a Range as described.
    • intersect

      Range intersect(Range range0, Range range1)
      Return the intersection Range of range0 and range1. In other words, the returned Range contains all x, where x is contained in both input ranges.The type of returned Range is same with two input ranges. Preconditions:
      > The range0 and range1 must be non- null.
      > The range0 and range1 must have a same type (integer/real)
      Parameters:
      range0 - a non-null Range
      range1 - a non-null Range of the same type (integer/real) as range0.
      Returns:
      a Range as described.
    • add

      Range add(Range range0, Range range1)
      Return a Range containing all x+y, where x is in range0 and y is in range1. The type of returned Range is same with two input ranges. Preconditions:
      > The range0 and range1 must be non- null.
      > The range0 and range1 must have a same type (integer/real)
      Parameters:
      range0 - a non-null Range
      range1 - a non-null Range of the same type (integer/real) as range0.
      Returns:
      a Range as described.
    • setMinus

      Range setMinus(Range range0, Range range1)
      Return the difference Range of range0 and range1. In other words, the returned Range contains all x, where x is contained in range0 but not in range1.The type of returned Range is same with two input ranges. Preconditions:
      > The range0 and range1 must be non- null.
      > The range0 and range1 must have a same type (integer/real)
      Parameters:
      range0 - a non-null Range
      range1 - a non-null Range of the same type (integer/real) as range0.
      Returns:
      a Range as described.
    • multiply

      Range multiply(Range range0, Range range1)
      Return a Range containing all x*y, where x is in range0 and y is in range1. The type of returned Range is same with two input ranges. Preconditions:
      > The range0 and range1 must be non- null.
      > The range0 and range1 must have a same type (integer/real)
      Parameters:
      range0 - a non-null Range
      range1 - a non-null Range of the same type (integer/real) as range0.
      Returns:
      a Range as described.
    • subtract

      Range subtract(Range range0, Range range1)
      Return a Range containing all x-y, where x is in range0 and y is in range1. The type of returned Range is same with two input ranges. Preconditions:
      > The range0 and range1 must be non- null.
      > The range0 and range1 must have a same type (integer/real)
      Parameters:
      range0 - a non-null Range
      range1 - a non-null Range of the same type (integer/real) as range0.
      Returns:
      a Range as described.
    • power

      Range power(Range range, int exp)
      Return a Range containing all x^exp, where x is in range and exp is a natural numbers. The type of returned Range is same with the input range. Preconditions:
      > The range must be non- null.
      > The exp must be a finite non-negative integer.
      Parameters:
      range - a non-null Range
      exp - a natural number as the exponent
      Returns:
      a Range as described.
    • power

      Range power(Range range, IntegerNumber exp)
      Return a Range containing all x^exp, where x is in range and exp is an IntegerNumber. The type of returned Range is same with the input range. Preconditions:
      > The range and exps must be non- null.
      > The exp must be a finite non-negative IntegerNumber.
      Parameters:
      range - a non-null Range
      exp - an IntegerNumber as the exponent
      Returns:
      a Range as described.
    • affineTransform

      Range affineTransform(Range range, Number a, Number b)
      Return a Range containing all x*a+b, where x is in range, a and b are Numbers. The type of returned Range is same with the input range. Preconditions:
      > The range, a and b must be non- null.
      > The range, a and b must have a same type(integer/real).
      > The a and b must be finite.
      Parameters:
      range - a non-null Range
      a - a non-null finite Number of the same type with range.
      b - a non-null finite Number of the same type with range.
      Returns:
      a Range as described.
    • divide

      Range divide(Range range, Number constant)
      Return a Range containing all x/constant, where x is in range and constant is a non- null and non-zero finite Number. The type of returned Range is same with the input range. Preconditions:
      > The range and constant must be non- null.
      > The range and constant must have a same type (integer/real)
      > The constant must be non-null, non-zero and finite.
      Parameters:
      range - a non-null Range
      constant - a non-null, non-zero and finite Number of the same type with range.
      Returns:
      a Range as described.
    • divide

      Range divide(Range range0, Range range1)
      Return a Range containing all x/y, where x is in range0 and y is is in range1. The type of returned Range is same with the both range. Preconditions:
      > The range0 and range1 must be non- null.
      > The range0 and range1 must have a same type (integer/real)
      Parameters:
      range0 - a non-null Range
      range1 - a non-null Range
      Returns:
      a Range as described.
    • multiply

      Range multiply(Range range, Number constant)
      Return a Range containing all x*constant, where x is in range and constant is a non- null finite Number. The type of returned Range is same with the input range. Preconditions:
      > The range and constant must be non- null.
      > The range and constant must have a same type (integer/real)
      > The constant must be non-null and finite.
      Parameters:
      range - a non-null Range
      constant - a non-null and finite Number of the same type with range.
      Returns:
      a Range as described.
    • add

      Range add(Range range, Number constant)
      Return a Range containing all x+constant, where x is in range and constant is a non- null finite Number. The type of returned Range is same with the input range. Preconditions:
      > The range and constant must be non- null.
      > The range and constant must have a same type (integer/real)
      > The constant must be non-null and finite.
      Parameters:
      range - a non-null Range
      constant - a non-null and finite Number of the same type with range.
      Returns:
      a Range as described.
    • subtract

      Range subtract(Range range, Number constant)
      Return a Range containing all x-constant, where x is in range and constant is a non- null finite Number. The type of returned Range is same with the input range. Preconditions:
      > The range and constant must be non- null.
      > The range and constant must have a same type (integer/real)
      > The constant must be non-null and finite.
      Parameters:
      range - a non-null Range
      constant - a non-null and finite Number of the same type with range.
      Returns:
      a Range as described.
    • newRange

      Range newRange(Interval... intervals)
      Create a new Range based on given non-null Intervals.
      If the given intervals represents an empty interval array, this function will return an empty Range with 0 interval. (i.e., zero would be the size of the interval array stored in this Range) Preconditions:
      > All given intervals must be non-null.
      > All given intervals must have a same type.
      Postconditions:
      > All intervals stored in the returned result will be simplified.
      Parameters:
      intervals - a set of Intervals of a same type (integer/real).
      Returns:
      a non-null Range representing the range represented by given intervals.
    • universalSet

      Range universalSet(boolean isIntegral)
      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

      Range expand(Range range, Range contextRange)
      Returns a Range R such that the intersection of R and C= contextRange is I=range and 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 expanded
      contextRange - the background context assumed to be true
      Returns:
      a range R satisfying R intersect C = I