sdsu.algorithms.data
Class BoundedRangeGenarator
java.lang.Object
|
+--sdsu.algorithms.data.BoundedRangeGenarator
- public class BoundedRangeGenarator
- extends java.lang.Object
- implements NumberGenerator
This class modifies sequence of numbers. It modifies the sequence so that
all numbers in the sequence are between a lower and upper bound. The lower bound
may be achieved, but the upper bound is not. That is all numbers will be in the range
[lowerBound, upperBound).
- Version:
- 1.0 18 June 1997
- Author:
- Roger Whitney (whitney@cs.sdsu.edu)
- See Also:
sdsu.data.NumberGenerator
Constructor Summary |
BoundedRangeGenarator(double lowerBound,
double upperBound,
NumberGenerator aGenerator)
Creates a generator that only produces numbers between
lowerBond and upperBound. |
Method Summary |
double |
nextElement()
Returns the next number in a sequence. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
BoundedRangeGenarator
public BoundedRangeGenarator(double lowerBound,
double upperBound,
NumberGenerator aGenerator)
throws java.lang.IllegalArgumentException
- Creates a generator that only produces numbers between
lowerBond and upperBound.
- Throws:
- java.lang.IllegalArgumentException - if lowerBound > upperBound
nextElement
public final double nextElement()
- Returns the next number in a sequence.
The number will be in the interval [lowerBound, upperBound).
- Specified by:
- nextElement in interface NumberGenerator