All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----com.ibm.eou.toolkit.util.Normalizer
protected Normalizer()
public static long normalizeNearest(long min,
long max,
long value,
long newMin,
long newMax)
For example, when mapping from the range [0,100] into the range [0,3], this function returns values as follows:
| 0-16 | gives | 0 |
| 17-49 | gives | 1 |
| 50-83 | gives | 2 |
| 84-100 | gives | 3 |
When mapping from the range [0,3] into the range [0,100], this function returns values as follows:
| 0 | gives | 0 |
| 1 | gives | 33 |
| 2 | gives | 66 |
| 3 | gives | 100 |
public static int normalizeNearest(long min,
long max,
long value,
int newMin,
int newMax)
public static long normalizeNearest(double min,
double max,
double value,
long newMin,
long newMax)
public static int normalizeNearest(double min,
double max,
double value,
int newMin,
int newMax)
public static long normalizeBalanced(long min,
long max,
long value,
long newMin,
long newMax)
For example, when mapping from the range [0,100] into the range [0,3], this function returns values as follows:
| 0-25 | gives | 0 |
| 26-50 | gives | 1 |
| 51-75 | gives | 2 |
| 76-100 | gives | 3 |
When mapping from the range [0,3] into the range [0,100], this function returns values as follows:
| 0 | gives | 0 |
| 1 | gives | 25 |
| 2 | gives | 50 |
| 3 | gives | 75 |
The inverse of this mapping is done by the unNormalizeBalanced method.
public static long unNormalizeBalanced(long min,
long max,
long value,
long newMin,
long newMax)
For example, when mapping from the range [0,3] into the range [0,100], this function returns values as follows:
| 0 | gives | 0 |
| 1 | gives | 26 |
| 2 | gives | 51 |
| 3 | gives | 76 |
When mapping from the range [0,100] into the range [0,3], this function returns values as follows:
| 0 | gives | 0 |
| 1-25 | gives | 1 |
| 26-50 | gives | 2 |
| 51-75 | gives | 3 |
| 76-100 | gives | 4 |
public static long normalizeDown(long min,
long max,
long value,
long newMin,
long newMax)
For example, when mapping from the range [0,100] into the range [0,3], this function returns values as follows:
| 0-33 | gives | 0 |
| 34-66 | gives | 1 |
| 67-99 | gives | 2 |
| 100 | gives | 3 |
When mapping from the range [0,3] into the range [0,100], this function returns values as follows:
| 0 | gives | 0 |
| 1 | gives | 33 |
| 2 | gives | 66 |
| 3 | gives | 100 |
public static long normalizeUp(long min,
long max,
long value,
long newMin,
long newMax)
For example, when mapping from the range [0,100] into the range [0,3], this function returns values as follows:
| 0 | gives | 0 |
| 1-33 | gives | 1 |
| 34-66 | gives | 2 |
| 67-100 | gives | 3 |
When mapping from the range [0,3] into the range [0,100], this function returns values as follows:
| 0 | gives | 0 |
| 1 | gives | 34 |
| 2 | gives | 67 |
| 3 | gives | 100 |
public static int normalizeBalanced(long min,
long max,
long value,
int newMin,
int newMax)
public static int normalizeDown(long min,
long max,
long value,
int newMin,
int newMax)
public static int normalizeUp(long min,
long max,
long value,
int newMin,
int newMax)
public static double normalize(long min,
long max,
long value,
double newMin,
double newMax)
All Packages Class Hierarchy This Package Previous Next Index