de.sciss.jcollider.gui

## Class NumberSpace

• ```public class NumberSpace
extends Object```
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.
Version:
0.25, 17-Sep-05
Author:
Hanns Holger Rutz
• ### Field Summary

Fields
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 Summary

Constructors
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.
• ### Method Summary

Methods
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).
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### min

`public final double min`
Minimum allowed value or Double.NEGATIVE_INFINITY
• #### max

`public final double max`
Maximum allowed value or Double.POSITIVE_INFINITY
• #### quant

`public final double quant`
Quantization of values or zero
• #### reset

`public final double reset`
Reset value, i.e. a kind of default value.
• #### minFracDigits

`public final int minFracDigits`
• #### maxFracDigits

`public final int maxFracDigits`
• #### genericDoubleSpace

`public static NumberSpace genericDoubleSpace`
Ready-made NumberField for double values, without boundaries.
• #### genericIntSpace

`public static NumberSpace genericIntSpace`
Ready-made NumberField for integer values, without boundaries.
• ### Constructor Detail

• #### NumberSpace

```public NumberSpace(double min,
double max,
double quant,
int minFracDigits,
int maxFracDigits,
double reset)```
Creates a new `NumberSpace` with the given values.
Parameters:
`min` - minimum allowed value or a special value like Double.NEGATIVE_INFINITY or Integer.MIN_VALUE
`max` - maximum allowed value or a special value like Float.POSITIVE_INFINITY or Long.MAX_VALUE
`quant` - 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.
• #### NumberSpace

```public NumberSpace(double min,
double max,
double quant,
int minFracDigits,
int maxFracDigits)```
Creates a new NumberSpace with the given values. Reset is zero or on of min/max, increment is max( 1, quant )
• #### NumberSpace

```public NumberSpace(double min,
double max,
double quant)```
Creates a new NumberSpace with the given values. Reset is zero or on of min/max, increment is max( 1, quant )
• ### Method Detail

• #### fracDigitsFromQuant

`public static int fracDigitsFromQuant(double quant)`
• #### isInteger

`public boolean isInteger()`
States if the NumberSpace's quant is integer (and not zero).
Returns:
true if the quantization is integer and hence all valid values are integers
• #### createIntSpace

```public static NumberSpace createIntSpace(int min,
int max)```
Utility method for creating a generic integer space for a given minimum and maximum value. Quant will be set to 1.0.
• #### fitValue

`public double fitValue(double value)`
Validates a value for this number space. First, it is quantized (rounded) if necessary. Then it is limited to the minimum and maximum value.
Parameters:
`value` - a value to validate
Returns:
the input value possibly quantisized and limited the space's bounds.
• #### fitValue

```public static double fitValue(double value,
double min,
double max,
double quant)```
Validates a value for an ad-hoc number space. First, it is quantized (rounded) if necessary. Then it is limited to the minimum and maximum value.
Parameters:
`value` - a value to validate
`min` - the minimum limitation
`max` - the maximum limitation
`quant` - the quantization to apply
Returns:
the input value possibly quantisized and limited the described space's bounds.