|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.amx.duet.tools.math.RangeUtil
A utility class used for range checking and scaling.
Constructor Summary | |
RangeUtil()
|
Method Summary | |
static int |
evaluateValue(int value,
int increment,
int min,
int max)
Used by adjust functions to set the scaled offset within the valid range. |
static boolean |
fnRangeCheck(int value,
int lowerBound,
int upperBound)
Deprecated. |
static float |
fnScaleRange(float value,
float sourceMin,
float sourceMax,
float targetMin,
float targetMax)
Deprecated. |
static int |
fnScaleRange(int value,
int sourceMin,
int sourceMax,
int targetMin,
int targetMax)
Deprecated. |
static boolean |
rangeCheck(int value,
int lowerBound,
int upperBound)
Determines if a specific value falls within the specified bounds. |
static float |
scaleRange(float value,
float sourceMin,
float sourceMax,
float targetMin,
float targetMax)
Scale incoming UI ranges to device ranges and scale incoming device ranges to UI ranges. |
static int |
scaleRange(int value,
int sourceMin,
int sourceMax,
int targetMin,
int targetMax)
Scale incoming UI ranges to device ranges and scale incoming device ranges to UI ranges. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RangeUtil()
Method Detail |
public static int evaluateValue(int value, int increment, int min, int max)
value
- is the value to be adjustedincrement
- is the currently evaluated step to be added to valuemin
- is the minimum number that value can be set tomax
- is the maximum number that value can be set to
public static boolean fnRangeCheck(int value, int lowerBound, int upperBound)
value
- - int value in questionlowerBound
- - int lower limitupperBound
- - int upper limit
{@link rangeCheck(int, int, int)}
Determines if a specific value falls within the specified bounds.
public static boolean rangeCheck(int value, int lowerBound, int upperBound)
value
- - int value in questionlowerBound
- - int lower limitupperBound
- - int upper limit
public static int fnScaleRange(int value, int sourceMin, int sourceMax, int targetMin, int targetMax)
value
- is the value to be scaledsourceMin
- is the minimum value of the current scale that value is insourceMax
- is the maximum value of the current scale that value is intargetMin
- is the minimum value of the scale to which value should be converted totargetMax
- is the maximum value of the scale to which value should be converted to
{@link scaleRange(int, int, int, int, int)}
Scale incoming UI ranges to device ranges and scale incoming device ranges to UI ranges.
Note: this method assumes that range checking has already been performed on the inputs.
public static float fnScaleRange(float value, float sourceMin, float sourceMax, float targetMin, float targetMax)
value
- is the value to be scaledsourceMin
- is the minimum value of the current scale that value is insourceMax
- is the maximum value of the current scale that value is intargetMin
- is the minimum value of the scale to which value should be converted totargetMax
- is the maximum value of the scale to which value should be converted to
{@link scaleRange(float, float, float, float, float)}
Scale incoming UI ranges to device ranges and scale incoming device ranges to UI ranges.
Note: this method assumes that range checking has already been performed on the inputs.
public static int scaleRange(int value, int sourceMin, int sourceMax, int targetMin, int targetMax)
value
- is the value to be scaledsourceMin
- is the minimum value of the current scale that value is insourceMax
- is the maximum value of the current scale that value is intargetMin
- is the minimum value of the scale to which value should be converted totargetMax
- is the maximum value of the scale to which value should be converted to
public static float scaleRange(float value, float sourceMin, float sourceMax, float targetMin, float targetMax)
value
- is the value to be scaledsourceMin
- is the minimum value of the current scale that value is insourceMax
- is the maximum value of the current scale that value is intargetMin
- is the minimum value of the scale to which value should be converted totargetMax
- is the maximum value of the scale to which value should be converted to
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |