Package org.apache.sis.coverage
Class ConvertedRange
- All Implemented Interfaces:
Serializable,Formattable,CheckedContainer<Double>,Emptiable
Range of real values computed from the range of the sample values.
The
Category.toConverse conversion is used by the caller for computing the inclusive and exclusive
minimum and maximum values of this range. We compute both the inclusive and exclusive values because we cannot
rely on the default implementation, which looks for the nearest representable number. For example if the range
of sample values is 0 to 10 exclusive (or 0 to 9 inclusive) and the scale is 2, then the range of real values
is 0 to 20 exclusive or 0 to 18 inclusive, not 0 to 19.9999… The numbers between 18 and 20 is a "gray area"
where we don't know for sure what the user intents to do.- Since:
- 1.0
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleThe maximal value to be returned bygetMaxDouble(boolean)when theinclusiveflag is the opposite ofRange.isMaxIncluded().private final doubleThe minimal value to be returned bygetMinDouble(boolean)when theinclusiveflag is the opposite ofRange.isMinIncluded().private static final longSerial number for inter-operability with different versions. -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)ConvertedRange(double[] extremums, boolean isMinIncluded, boolean isMaxIncluded, javax.measure.Unit<?> unit) Constructs a range ofdoublevalues.privateConvertedRange(NumberRange<Double> union, ConvertedRange r1, NumberRange<Double> r2) Completes the union computed byRange.union(Range)with the unions of alternative extremum. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetMaxDouble(boolean inclusive) Returns the maximum value with the specified inclusive or exclusive state.doublegetMinDouble(boolean inclusive) Returns the minimum value with the specified inclusive or exclusive state.Returns the union of this range with the given range.Methods inherited from class org.apache.sis.measure.MeasurementRange
castTo, contains, convertTo, create, create, createBestFit, createGreaterThan, equals, hashCode, intersect, intersects, subtract, unitMethods inherited from class org.apache.sis.measure.NumberRange
castOrCopy, containsAny, containsAny, create, create, create, create, create, create, create, createBestFit, createBestFit, createLeftBounded, getMaxDouble, getMedian, getMinDouble, getSpan, intersectAny, intersectsAny, subtractAny, transform, unionAnyMethods inherited from class org.apache.sis.measure.Range
contains, formatTo, getElementType, getMaxValue, getMinValue, isBounded, isEmpty, isMaxIncluded, isMinIncluded, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
altMinimum
private final double altMinimumThe minimal value to be returned bygetMinDouble(boolean)when theinclusiveflag is the opposite ofRange.isMinIncluded(). -
altMaximum
private final double altMaximumThe maximal value to be returned bygetMaxDouble(boolean)when theinclusiveflag is the opposite ofRange.isMaxIncluded().
-
-
Constructor Details
-
ConvertedRange
ConvertedRange(double[] extremums, boolean isMinIncluded, boolean isMaxIncluded, javax.measure.Unit<?> unit) Constructs a range ofdoublevalues. -
ConvertedRange
Completes the union computed byRange.union(Range)with the unions of alternative extremum.
-
-
Method Details
-
union
Returns the union of this range with the given range.- Overrides:
unionin classMeasurementRange<Double>- Parameters:
range- the range to add to this range.- Returns:
- the union of this range with the given range.
-
getMinDouble
public double getMinDouble(boolean inclusive) Returns the minimum value with the specified inclusive or exclusive state.- Overrides:
getMinDoublein classNumberRange<Double>- Parameters:
inclusive-truefor the minimum value inclusive, orfalsefor the minimum value exclusive.- Returns:
- the minimum value, inclusive or exclusive as requested.
-
getMaxDouble
public double getMaxDouble(boolean inclusive) Returns the maximum value with the specified inclusive or exclusive state.- Overrides:
getMaxDoublein classNumberRange<Double>- Parameters:
inclusive-truefor the maximum value inclusive, orfalsefor the maximum value exclusive.- Returns:
- the maximum value, inclusive or exclusive as requested.
-