generator.data
Class IntervalNoUnion

java.lang.Object
  extended by data.Interval
      extended by generator.data.IntervalNoUnion
All Implemented Interfaces:
java.io.Serializable

public class IntervalNoUnion
extends Interval

Interval No Union

This is a an enhanced version of Interval for use with a intervalNoUnionList. New functions useful for the generator have also been created.

Copyright(c) 2005 Université Laval, LSFM research group.

Version:
1.3
Author:
Frédérick Lemay
See Also:
Serialized Form

Field Summary
 
Fields inherited from class data.Interval
EMPTY_INTERVAL, R
 
Constructor Summary
IntervalNoUnion(boolean lowerBoundIsIncluded, double lowerBound, double upperBound, boolean upperBoundIsIncluded)
          Initialization constructor ... calls the constructor of Interval.
 
Method Summary
 boolean canProduceInteger()
          Checks if at least one integer is included in the interval
 IntervalListNoUnion divide(int numberOfParts)
          Split an interval in a specified number of smaller intervals.
 double giveADouble()
          Obtains a real number included in the interval
 int giveAnInteger()
          Obtains an integer number included in the current interval.
 
Methods inherited from class data.Interval
closure, equals, getLowerBound, getNb, getUpperBound, hashCode, intersectionOf, intersectsWith, isDiscrete, isIn, isIncluded, isLowerBoundIncluded, isUpperBoundIncluded, setIsLowerBoundIncluded, setIsUpperBoundIncluded, setLowerBound, setNb, setUpperBound, toString, unionOf, verifierInvariants
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntervalNoUnion

public IntervalNoUnion(boolean lowerBoundIsIncluded,
                       double lowerBound,
                       double upperBound,
                       boolean upperBoundIsIncluded)
Initialization constructor ... calls the constructor of Interval.

Parameters:
lowerBoundIsIncluded - true if the lower bound is included
lowerBound - the lower bound value
upperBound - the upper bound value
upperBoundIsIncluded - true if the upper bound is included
Method Detail

canProduceInteger

public boolean canProduceInteger()
Checks if at least one integer is included in the interval

Returns:
true if generating an integer in the interval is possible

divide

public IntervalListNoUnion divide(int numberOfParts)
                           throws PartitionException
Split an interval in a specified number of smaller intervals. Since all bounds of these smaller intervals are real numbers, a call to partition will return the length of these intervals.

Parameters:
numberOfParts - the number of intervals to create
Returns:
a list of smaller intervals created from this interval
Throws:
PartitionException - if partition fails

giveADouble

public double giveADouble()
Obtains a real number included in the interval

Returns:
a real number included in the interval

giveAnInteger

public int giveAnInteger()
                  throws IntervalNoUnionException
Obtains an integer number included in the current interval.

Returns:
an integer number included in the current interval.
Throws:
IntervalNoUnionException - if no integer can be produced