public class FloatBoundedQuantization extends Object
[a; b]
and an integer interval of the form [0, n]
.
This class is particularly useful to bind signals to GUI components.
Modifier and Type | Class and Description |
---|---|
class |
FloatBoundedQuantization.Variable
Quantized variables of apparent type float, backed with a mutable
integer store.
|
Constructor and Description |
---|
FloatBoundedQuantization(int resolution,
float min,
float max,
float defaultInitial) |
Modifier and Type | Method and Description |
---|---|
FloatBoundedQuantization.Variable |
createVariable()
Creates a new quantized variable with the default initial value.
|
FloatBoundedQuantization.Variable |
createVariable(float initialValue)
Creates a new quantized variable with the given initial value.
|
float |
getDefaultInitialValue() |
float |
getMaxValue() |
float |
getMinValue() |
int |
getResolution() |
String |
getTemplate(boolean leadingZero) |
int |
quantize(float value)
Converts robustly from the float interval to the integer
interval.
|
float |
unquantize(int level)
Converts strictly from the interval interval to the float
interval.
|
public FloatBoundedQuantization(int resolution, float min, float max, float defaultInitial)
public final int getResolution()
public final float getMinValue()
public final float getMaxValue()
public final float getDefaultInitialValue()
public String getTemplate(boolean leadingZero)
public int quantize(float value)
public float unquantize(int level)
public FloatBoundedQuantization.Variable createVariable(float initialValue)
public FloatBoundedQuantization.Variable createVariable()
getDefaultInitialValue()