All Packages Class Hierarchy This Package Previous Next Index
Class COM.ibm.beans.gauge.Normalizer
java.lang.Object
|
+----COM.ibm.beans.gauge.Normalizer
- public class Normalizer
- extends Object
This class contains methods to map values from one range to
another in several different ways
Normalizer()
-
normalize(long,
long, long, double, double)
- Compute a value in a new range corresponding to the given
value in the given range.
normalizeBalanced(long,
long, long, int, int)
- A version of normalizeBalanced where the new range and
the return value has type int rather than long.
normalizeBalanced(long,
long, long, long, long)
- Compute a value in a new range corresponding to the given
value in the given range.
normalizeBalanced2(long,
long, long, int, int)
- A version of normalizeBalanced2 where the new range and
the return value has type int rather than long.
normalizeBalanced2(long,
long, long, long, long)
- Compute a value in a new range corresponding to the given
value in the given range.
normalizeDown(long,
long, long, int, int)
- A version of normalizeDown where the new range and the
return value has type int rather than long.
normalizeDown(long,
long, long, long, long)
- Compute a value in a new range corresponding to the given
value in the given range.
normalizeUp(long,
long, long, int, int)
- A version of normalizeUp where the new range and the
return value has type int rather than long
normalizeUp(long,
long, long, long, long)
- Compute a value in a new range corresponding to the given
value in the given range.
unNormalizeBalanced(long,
long, long, long, long)
- Compute a value in a new range corresponding to the given
value in the given range.
Normalizer
protected Normalizer()
normalizeBalanced2
public static long normalizeBalanced2(long min,
long max,
long value,
long newMin,
long newMax)
- Compute a value in a new range corresponding to the given
value in the given range. The new range and the returned
value are of type long, and so the rounding is done in a
balanced fashion to give the nearest value in the new
range corresponding to the given value in the original
range.
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 |
- Parameters:
- min - start of the original range
- max - end of the original range
- value - given value in the original range
- newMin - start of the new range
- newMax - end of the new range
- Returns:
- corresponding value in the new range
- See Also:
- normalizeDown, normalizeUp, normalize
normalizeBalanced
public static long normalizeBalanced(long min,
long max,
long value,
long newMin,
long newMax)
- Compute a value in a new range corresponding to the given
value in the given range. The new range and the returned
value are of type long, and so the rounding is done in a
balanced fashion to give the nearest value in the new
range corresponding to the given value in the original
range.
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.
- Parameters:
- min - start of the original range
- max - end of the original range
- value - given value in the original range
- newMin - start of the new range
- newMax - end of the new range
- Returns:
- corresponding value in the new range
- See Also:
- unNormalizeBalanced,
normalizeDown, normalizeUp, normalize
unNormalizeBalanced
public static long unNormalizeBalanced(long min,
long max,
long value,
long newMin,
long newMax)
- Compute a value in a new range corresponding to the given
value in the given range. The new range and the returned
value are of type long, and the rounding is done in an
exotic fashion intended to provide an inverse to the
normalizeBalanced method.
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 |
- Parameters:
- min - start of the original range
- max - end of the original range
- value - given value in the original range
- newMin - start of the new range
- newMax - end of the new range
- Returns:
- corresponding value in the new range
- See Also:
- normalizeBalanced,
normalizeUp, normalizeDown, normalize
normalizeDown
public static long normalizeDown(long min,
long max,
long value,
long newMin,
long newMax)
- Compute a value in a new range corresponding to the given
value in the given range. The new range and the returned
value are of type long, and the rounding is done
downwards.
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 |
- Parameters:
- min - start of the original range
- max - end of the original range
- value - given value in the original range
- newMin - start of the new range
- newMax - end of the new range
- Returns:
- corresponding value in the new range
- See Also:
- normalizeBalanced,
normalizeUp, normalize
normalizeUp
public static long normalizeUp(long min,
long max,
long value,
long newMin,
long newMax)
- Compute a value in a new range corresponding to the given
value in the given range. The new range and the returned
value are of type long, and the rounding is done upwards.
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 |
- Parameters:
- min - start of the original range
- max - end of the original range
- value - given value in the original range
- newMin - start of the new range
- newMax - end of the new range
- Returns:
- corresponding value in the new range
- See Also:
- normalizeBalanced,
normalizeDown, normalize
normalizeBalanced2
public static int normalizeBalanced2(long min,
long max,
long value,
int newMin,
int newMax)
- A version of normalizeBalanced2 where the new range and
the return value has type int rather than long.
- See Also:
- normalizeBalanced2
normalizeBalanced
public static int normalizeBalanced(long min,
long max,
long value,
int newMin,
int newMax)
- A version of normalizeBalanced where the new range and
the return value has type int rather than long.
- See Also:
- normalizeBalanced
normalizeDown
public static int normalizeDown(long min,
long max,
long value,
int newMin,
int newMax)
- A version of normalizeDown where the new range and the
return value has type int rather than long.
- See Also:
- normalizeDown
normalizeUp
public static int normalizeUp(long min,
long max,
long value,
int newMin,
int newMax)
- A version of normalizeUp where the new range and the
return value has type int rather than long
- See Also:
- normalizeUp
normalize
public static double normalize(long min,
long max,
long value,
double newMin,
double newMax)
- Compute a value in a new range corresponding to the given
value in the given range. The new range and the returned
value are of type double, and so there is no rounding
done.
- Parameters:
- min - start of the original range
- max - end of the original range
- value - given value in the original range
- newMin - start of the new range
- newMax - end of the new range
- Returns:
- corresponding value in the new range
- See Also:
- normalizeBalanced,
normalizeDown, normalizeUp, unNormalizeBalanced
All Packages Class Hierarchy This Package Previous Next Index
Copyright ©
Taligent, Inc. 1996 - 1997.
Copyright © IBM Corporation 1996 - 1997.
All Rights Reserved.