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 double
The maximal value to be returned bygetMaxDouble(boolean)
when theinclusive
flag is the opposite ofRange.isMaxIncluded()
.private final double
The minimal value to be returned bygetMinDouble(boolean)
when theinclusive
flag is the opposite ofRange.isMinIncluded()
.private static final long
Serial 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 ofdouble
values.private
ConvertedRange
(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 TypeMethodDescriptiondouble
getMaxDouble
(boolean inclusive) Returns the maximum value with the specified inclusive or exclusive state.double
getMinDouble
(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, unit
Methods 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, unionAny
Methods 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 theinclusive
flag is the opposite ofRange.isMinIncluded()
. -
altMaximum
private final double altMaximumThe maximal value to be returned bygetMaxDouble(boolean)
when theinclusive
flag is the opposite ofRange.isMaxIncluded()
.
-
-
Constructor Details
-
ConvertedRange
ConvertedRange(double[] extremums, boolean isMinIncluded, boolean isMaxIncluded, javax.measure.Unit<?> unit) Constructs a range ofdouble
values. -
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:
union
in 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:
getMinDouble
in classNumberRange<Double>
- Parameters:
inclusive
-true
for the minimum value inclusive, orfalse
for 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:
getMaxDouble
in classNumberRange<Double>
- Parameters:
inclusive
-true
for the maximum value inclusive, orfalse
for the maximum value exclusive.- Returns:
- the maximum value, inclusive or exclusive as requested.
-