com.amx.duet.tools.math
Class RangeUtil

java.lang.Object
  extended bycom.amx.duet.tools.math.RangeUtil

public class RangeUtil
extends java.lang.Object

A utility class used for range checking and scaling.

Version:
1.0.0

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

RangeUtil

public RangeUtil()
Method Detail

evaluateValue

public static int evaluateValue(int value,
                                int increment,
                                int min,
                                int max)
Used by adjust functions to set the scaled offset within the valid range.

Parameters:
value - is the value to be adjusted
increment - is the currently evaluated step to be added to value
min - is the minimum number that value can be set to
max - is the maximum number that value can be set to
Returns:
integer containing the newly calculated value which can be sent to a setter method directly

fnRangeCheck

public static boolean fnRangeCheck(int value,
                                   int lowerBound,
                                   int upperBound)
Deprecated.  

Parameters:
value - - int value in question
lowerBound - - int lower limit
upperBound - - int upper limit
Returns:
boolean - result
See Also:
{@link rangeCheck(int, int, int)} Determines if a specific value falls within the specified bounds.

rangeCheck

public static boolean rangeCheck(int value,
                                 int lowerBound,
                                 int upperBound)
Determines if a specific value falls within the specified bounds.

Parameters:
value - - int value in question
lowerBound - - int lower limit
upperBound - - int upper limit
Returns:
boolean - result

fnScaleRange

public static int fnScaleRange(int value,
                               int sourceMin,
                               int sourceMax,
                               int targetMin,
                               int targetMax)
Deprecated.  

Parameters:
value - is the value to be scaled
sourceMin - is the minimum value of the current scale that value is in
sourceMax - is the maximum value of the current scale that value is in
targetMin - is the minimum value of the scale to which value should be converted to
targetMax - is the maximum value of the scale to which value should be converted to
Returns:
integer value of the scaled value
See Also:
{@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.

fnScaleRange

public static float fnScaleRange(float value,
                                 float sourceMin,
                                 float sourceMax,
                                 float targetMin,
                                 float targetMax)
Deprecated.  

Parameters:
value - is the value to be scaled
sourceMin - is the minimum value of the current scale that value is in
sourceMax - is the maximum value of the current scale that value is in
targetMin - is the minimum value of the scale to which value should be converted to
targetMax - is the maximum value of the scale to which value should be converted to
Returns:
float value of the scaled value
See Also:
{@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.

scaleRange

public 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. Note: this method assumes that range checking has already been performed on the inputs.

Parameters:
value - is the value to be scaled
sourceMin - is the minimum value of the current scale that value is in
sourceMax - is the maximum value of the current scale that value is in
targetMin - is the minimum value of the scale to which value should be converted to
targetMax - is the maximum value of the scale to which value should be converted to
Returns:
integer value of the scaled value

scaleRange

public 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. Note: this method assumes that range checking has already been performed on the inputs.

Parameters:
value - is the value to be scaled
sourceMin - is the minimum value of the current scale that value is in
sourceMax - is the maximum value of the current scale that value is in
targetMin - is the minimum value of the scale to which value should be converted to
targetMax - is the maximum value of the scale to which value should be converted to
Returns:
float value of the scaled value


Copyright © 2008 AMX LLC. All Rights Reserved.