public class NumberSpace extends Object
Modifier and Type | Field and Description |
---|---|
static NumberSpace |
genericDoubleSpace
Ready-made NumberField for
double values, without boundaries.
|
static NumberSpace |
genericIntSpace
Ready-made NumberField for
integer values, without boundaries.
|
double |
max
Maximum allowed value
or Double.POSITIVE_INFINITY
|
int |
maxFracDigits |
double |
min
Minimum allowed value
or Double.NEGATIVE_INFINITY
|
int |
minFracDigits |
double |
quant
Quantization of values
or zero
|
double |
reset
Reset value, i.e.
|
Constructor and Description |
---|
NumberSpace(double min,
double max,
double quant)
Creates a new NumberSpace
with the given values.
|
NumberSpace(double min,
double max,
double quant,
int minFracDigits,
int maxFracDigits)
Creates a new NumberSpace
with the given values.
|
NumberSpace(double min,
double max,
double quant,
int minFracDigits,
int maxFracDigits,
double reset)
Creates a new
NumberSpace
with the given values. |
Modifier and Type | Method and Description |
---|---|
static NumberSpace |
createIntSpace(int min,
int max)
Utility method for creating a generic integer space
for a given minimum and maximum value.
|
double |
fitValue(double value)
Validates a value for this number space.
|
static double |
fitValue(double value,
double min,
double max,
double quant)
Validates a value for an ad-hoc number space.
|
static int |
fracDigitsFromQuant(double quant) |
boolean |
isInteger()
States if the NumberSpace's quant
is integer (and not zero).
|
public final double min
public final double max
public final double quant
public final double reset
public final int minFracDigits
public final int maxFracDigits
public static NumberSpace genericDoubleSpace
public static NumberSpace genericIntSpace
public NumberSpace(double min, double max, double quant, int minFracDigits, int maxFracDigits, double reset)
NumberSpace
with the given values.min
- minimum allowed value or a special value like Double.NEGATIVE_INFINITY
or Integer.MIN_VALUEmax
- maximum allowed value or a special value like Float.POSITIVE_INFINITY
or Long.MAX_VALUEquant
- coarsity for each allowed value. E.g. if quant is 0.1, then a
value of 0.12 becomes 0.1 if you call fitValue. If quant is 0.0,
no quantization is used. If quant is integer, the number space is
marked integer and calling isInteger returns true.reset
- central value for initializations of unknown values. Usually zero.public NumberSpace(double min, double max, double quant, int minFracDigits, int maxFracDigits)
public NumberSpace(double min, double max, double quant)
public static int fracDigitsFromQuant(double quant)
public boolean isInteger()
public static NumberSpace createIntSpace(int min, int max)
public double fitValue(double value)
value
- a value to validatepublic static double fitValue(double value, double min, double max, double quant)
value
- a value to validatemin
- the minimum limitationmax
- the maximum limitationquant
- the quantization to applyCopyright © 2015–2022 SciJava. All rights reserved.