Uncommons Maths API
(Version 1.2.3)

Class AdjustableNumberGenerator<T extends Number>

  extended by org.uncommons.maths.number.AdjustableNumberGenerator<T>
Type Parameters:
T - The type of number generated by this number generator.
All Implemented Interfaces:

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

Implementation of NumberGenerator that works similarly to ConstantGenerator but allows the returned value to be changed after instantiation. The most useful application of this type of number generator is to permit runtime re-configuration of objects that rely on NumberGenerators for their parameters. This can be achieved by creating UI components (e.g. sliders and spinners) that invoke setValue(Number) when their state changes.

Daniel Dyer

Constructor Summary
AdjustableNumberGenerator(T value)
Method Summary
 T nextValue()
 void setValue(T value)
          Change the value that is returned by this generator.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public AdjustableNumberGenerator(T value)
value - The initial value returned by all invocations of nextValue() (until it is modified by a call to setValue(Number).
Method Detail


public void setValue(T value)
Change the value that is returned by this generator.

value - The new value to return.


public T nextValue()

Specified by:
nextValue in interface NumberGenerator<T extends Number>
The next value from the generator.

Uncommons Maths API
(Version 1.2.3)