Uncommons Maths API
(Version 1.2.3)

org.uncommons.maths.number
Class ConstantGenerator<T extends Number>

java.lang.Object
  extended by org.uncommons.maths.number.ConstantGenerator<T>
Type Parameters:
T - The numeric type (Integer, Long, Double, etc.) of the constant.
All Implemented Interfaces:
NumberGenerator<T>

public class ConstantGenerator<T extends Number>
extends Object
implements NumberGenerator<T>

Convenience implementation of NumberGenerator that always returns the same value.

Author:
Daniel Dyer

Constructor Summary
ConstantGenerator(T constant)
          Creates a number generator that always returns the same values.
 
Method Summary
 T nextValue()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantGenerator

public ConstantGenerator(T constant)
Creates a number generator that always returns the same values.

Parameters:
constant - The value to be returned by all invocations of the nextValue() method.
Method Detail

nextValue

public T nextValue()
Specified by:
nextValue in interface NumberGenerator<T extends Number>
Returns:
The constant value specified when the generator was constructed.

Uncommons Maths API
(Version 1.2.3)