Package org.esa.snap.core.util.math
Class Range
- java.lang.Object
-
- org.esa.snap.core.util.math.Range
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
aggregate(Object values, boolean unsigned, IndexValidator validator, ProgressMonitor pm)
static Range
computeRangeByte(byte[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenbyte
array.static Range
computeRangeDouble(double[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givendouble
array.static Range
computeRangeDouble(double[] values, Range range)
Computes the value range for the values in the givendouble
array.static Range
computeRangeDouble(DoubleList values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenRange.DoubleList
.static Range
computeRangeFloat(float[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenfloat
array.static Range
computeRangeGeneric(Object values, boolean unsigned, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenObject
.static Range
computeRangeInt(int[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenint
array.static Range
computeRangeShort(short[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenshort
array.static Range
computeRangeUByte(byte[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenbyte
array.static Range
computeRangeUInt(int[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenint
array.static Range
computeRangeUShort(short[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenshort
array.double
getMax()
Gets the maximum value.double
getMin()
Gets the mimimum value.boolean
isValid()
Checks if this range is valid.void
setMax(double max)
Sets the maximum value.void
setMin(double min)
Sets the mimimum value.void
setMinMax(double min, double max)
Sets the mimimum and maximum value.String
toString()
-
-
-
Method Detail
-
getMin
public double getMin()
Gets the mimimum value.- Returns:
- the mimimum value
-
setMin
public void setMin(double min)
Sets the mimimum value.- Parameters:
min
- the mimimum value
-
getMax
public double getMax()
Gets the maximum value.- Returns:
- the maximum value
-
setMax
public void setMax(double max)
Sets the maximum value.- Parameters:
max
- the maximum value
-
setMinMax
public void setMinMax(double min, double max)
Sets the mimimum and maximum value.- Parameters:
min
- the mimimum valuemax
- the maximum value
-
isValid
public boolean isValid()
Checks if this range is valid.- Returns:
true
if minimum value is greater than the maximum value
-
aggregate
public void aggregate(Object values, boolean unsigned, IndexValidator validator, ProgressMonitor pm)
-
computeRangeByte
public static Range computeRangeByte(byte[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenbyte
array. The array elements are interpreted as signed byte values. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.- Parameters:
values
- the array whose value range to computevalidator
- used to validate the array indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is createdpm
- a monitor to inform the user about progress- Returns:
- the value range for the given array
-
computeRangeUByte
public static Range computeRangeUByte(byte[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenbyte
array. The array elements are interpreted as unsigned byte values. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.- Parameters:
values
- the array whose value range to computevalidator
- used to validate the array indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is createdpm
- a monitor to inform the user about progress- Returns:
- the value range for the given array
-
computeRangeShort
public static Range computeRangeShort(short[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenshort
array. The array elements are interpreted as signed short values. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.- Parameters:
values
- the array whose value range to computevalidator
- used to validate the array indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is createdpm
- a monitor to inform the user about progress- Returns:
- the value range for the given array
-
computeRangeUShort
public static Range computeRangeUShort(short[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenshort
array. The array elements are interpreted as unsigned short values. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.- Parameters:
values
- the array whose value range to computevalidator
- used to validate the array indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is created- Returns:
- the value range for the given array
-
computeRangeInt
public static Range computeRangeInt(int[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenint
array. The array elements are interpreted as signed int values. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.- Parameters:
values
- the array whose value range to computevalidator
- used to validate the array indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is createdpm
- a monitor to inform the user about progress- Returns:
- the value range for the given array
-
computeRangeUInt
public static Range computeRangeUInt(int[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenint
array. The array elements are interpreted as unsigned int values. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.- Parameters:
values
- the array whose value range to computevalidator
- used to validate the array indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is createdpm
- a monitor to inform the user about progress- Returns:
- the value range for the given array
-
computeRangeFloat
public static Range computeRangeFloat(float[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenfloat
array. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.- Parameters:
values
- the array whose value range to computevalidator
- used to validate the array indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is createdpm
- a monitor to inform the user about progress- Returns:
- the value range for the given array
-
computeRangeDouble
public static Range computeRangeDouble(double[] values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givendouble
array. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.- Parameters:
values
- the array whose value range to computevalidator
- used to validate the array indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is createdpm
- a monitor to inform the user about progress- Returns:
- the value range for the given array
-
computeRangeDouble
public static Range computeRangeDouble(double[] values, Range range)
Computes the value range for the values in the givendouble
array.- Parameters:
values
- the array whose value range to computerange
- if notnull
, used as return value, otherwise a new instance is created- Returns:
- the value range for the given array
-
computeRangeDouble
public static Range computeRangeDouble(DoubleList values, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenRange.DoubleList
. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.- Parameters:
values
- theRange.DoubleList
whose value range to computevalidator
- used to validate the indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is createdpm
- a monitor to inform the user about progress- Returns:
- the value range for the given values
-
computeRangeGeneric
public static Range computeRangeGeneric(Object values, boolean unsigned, IndexValidator validator, Range range, ProgressMonitor pm)
Computes the value range for the values in the givenObject
. Values at a given indexi
for whichvalidator.validate(i)
returnsfalse
are excluded from the computation.
Supportet types for the values object:byte[], short[], int[], float[], double[],
DoubleList
- Parameters:
values
- theObject
whose value range to computeunsigned
- if true interprete all the values as unsignet type.validator
- used to validate the indexes, must not benull
. UseIndexValidator.TRUE
instead.range
- if notnull
, used as return value, otherwise a new instance is createdpm
- a monitor to inform the user about progress- Returns:
- the value range for the given values
- Throws:
IllegalArgumentException
- if the given object is not an istance of the supported types.
-
-