Package org.uncommons.maths.number
Class ConstantGenerator<T extends Number>
java.lang.Object
org.uncommons.maths.number.ConstantGenerator<T>
- Type Parameters:
T
- The numeric type (Integer, Long, Double, etc.) of the constant.
- All Implemented Interfaces:
NumberGenerator<T>
Convenience implementation of
NumberGenerator
that always
returns the same value.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstantGenerator
(T constant) Creates a number generator that always returns the same values. -
Method Summary
-
Field Details
-
constant
-
-
Constructor Details
-
ConstantGenerator
Creates a number generator that always returns the same values.- Parameters:
constant
- The value to be returned by all invocations of thenextValue()
method.
-
-
Method Details
-
nextValue
- Specified by:
nextValue
in interfaceNumberGenerator<T extends Number>
- Returns:
- The constant value specified when the generator was constructed.
-