|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.sciss.util.NumberSpace
public class NumberSpace
A number space describes a field of possible numeric values with a minimum and maximum (which can be infinity), a central value (usually zero) a quantization size which can be used to describe integers or to limit the numeric resolution.
Field Summary | |
---|---|
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 Summary | |
---|---|
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. |
Method Summary | |
---|---|
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). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
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)
Method Detail |
---|
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 validate
public 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 apply
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |