visad.data.in
Class ValueRanger

java.lang.Object
  extended by visad.data.in.ValueProcessor
      extended by visad.data.in.ValueRanger

public class ValueRanger
extends ValueProcessor

Provides support for ranging data values (i.e. checking to see that they lie within a valid range).

Instances are immutable.

Author:
Steven R. Emmerson

Field Summary
 
Fields inherited from class visad.data.in.ValueProcessor
trivialProcessor
 
Constructor Summary
protected ValueRanger()
          Constructs from nothing.
 
Method Summary
 boolean equals(Object obj)
          Indicates if this instance is semantically identical to another object.
 double getMax()
          Returns the maximum, valid value.
 double getMin()
          Returns the minimum, valid value.
 int hashCode()
          Returns the hash code of this instance.
 double process(double value)
          Ranges a value.
 double[] process(double[] values)
          Ranges values.
 float process(float value)
          Ranges a value.
 float[] process(float[] values)
          Ranges values.
static ValueRanger valueRanger(double lower, double upper)
          Returns an instance of this class corresponding to valid-range limits.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueRanger

protected ValueRanger()
Constructs from nothing.

Method Detail

valueRanger

public static ValueRanger valueRanger(double lower,
                                      double upper)
Returns an instance of this class corresponding to valid-range limits.

Parameters:
lower - The lower limit of the valid range. May be NaN or Double.NEGATIVE_INFINITY to indicate no limit.
upper - The upper limit of the valid range. May be NaN or Double.POSITIVE_INFINITY to indicate no limit.

getMin

public double getMin()
Returns the minimum, valid value.

Returns:
The minimum, valid value.

getMax

public double getMax()
Returns the maximum, valid value.

Returns:
The maximum, valid value.

process

public float process(float value)
Ranges a value.

Specified by:
process in class ValueProcessor
Parameters:
value - The value to be processed.
Returns:
The original value if it lay within the valid range; otherwise Float.NaN.

process

public double process(double value)
Ranges a value.

Specified by:
process in class ValueProcessor
Parameters:
value - The values to be processed.
Returns:
The original value if it lay within the valid range; otherwise Double.NaN.

process

public float[] process(float[] values)
Ranges values.

Specified by:
process in class ValueProcessor
Parameters:
values - The value to be processed.
Returns:
The original array with values that fall outside the valid range replaced with Float.NaN.

process

public double[] process(double[] values)
Ranges values.

Specified by:
process in class ValueProcessor
Parameters:
values - The values to be processed.
Returns:
The original array with values that fall outside the valid range replaced with Double.NaN.

equals

public boolean equals(Object obj)
Indicates if this instance is semantically identical to another object.

Overrides:
equals in class Object
Parameters:
obj - The other object.
Returns:
true if and only if this instance is semantically identical to the other object.

hashCode

public int hashCode()
Returns the hash code of this instance.

Overrides:
hashCode in class Object
Returns:
The hash code of this instance.