org.robokind.api.common.position
Class NumberRange

java.lang.Object
  extended by org.robokind.api.common.position.NumberRange
All Implemented Interfaces:
NormalizableRange<Integer>

public class NumberRange
extends Object
implements NormalizableRange<Integer>

Specifies a simple NormalizableRange of Numbers defined by a min and max. The min is specifies the number corresponding to 0.0 when normalized. The min is not always less than the max (using compareTo()). If the min is larger than the max, it results is reversing the direction of the range.

Author:
Matthew Stevenson

Constructor Summary
NumberRange(int min, int max)
           
 
Method Summary
 Integer denormalizeValue(NormalizedDouble v)
          Denormalizes a NormalizedDouble to a value within this NormalizableRange.
 boolean isValid(Integer val)
          Returns true if t is within the NormalizableRange.
 NormalizedDouble normalizeValue(Integer val)
          Normalizes a value within the NormalizableRange.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberRange

public NumberRange(int min,
                   int max)
Method Detail

isValid

public boolean isValid(Integer val)
Description copied from interface: NormalizableRange
Returns true if t is within the NormalizableRange.

Specified by:
isValid in interface NormalizableRange<Integer>
Parameters:
val - value to check
Returns:
true if t is within the NormalizableRange

normalizeValue

public NormalizedDouble normalizeValue(Integer val)
Description copied from interface: NormalizableRange
Normalizes a value within the NormalizableRange.

Specified by:
normalizeValue in interface NormalizableRange<Integer>
Parameters:
val - value to normalize
Returns:
value within the NormalizableRange, null if t is out of range

denormalizeValue

public Integer denormalizeValue(NormalizedDouble v)
Description copied from interface: NormalizableRange
Denormalizes a NormalizedDouble to a value within this NormalizableRange.

Specified by:
denormalizeValue in interface NormalizableRange<Integer>
Parameters:
v - value to denormalize
Returns:
non-normalized value within the NormalizableRange


Copyright © 2011. All Rights Reserved.