T
- The type of number generated by this number generator.public class AdjustableNumberGenerator<T extends Number> extends Object implements NumberGenerator<T>
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 NumberGenerator
s
for their parameters. This can be achieved by creating UI components (e.g.
sliders and spinners) that invoke setValue(Number)
when their state
changes.Constructor and Description |
---|
AdjustableNumberGenerator(T value) |
Modifier and Type | Method and Description |
---|---|
T |
nextValue() |
void |
setValue(T value)
Change the value that is returned by this generator.
|
public AdjustableNumberGenerator(T value)
value
- The initial value returned by all invocations of nextValue()
(until it is modified by a call to setValue(Number)
.Copyright © 2015. All rights reserved.