Package org.apache.sis.coverage
Class ToNaN
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Integer>,Collection<Integer>,DoubleToIntFunction,Set<Integer>
Keep trace of allocated
Float.NaN ordinal values for avoiding range collisions when building categories.
This is a temporary object used only at SampleDimension construction time for producing values suitable
to MathFunctions.toNanFloat(int). Instances of this class are given for toNaN argument in the
Category constructor.- Since:
- 1.0
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) NumberThe value which should be assigned ordinal 0 if that ordinal value is available. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintapplyAsInt(double value) Mapping from sample values to ordinal values to be supplied toMathFunctions.toNanFloat(int).voidclear()Sets this function to the same state than after construction.private booleanisBackground(double value) Returnstrueif the specified value is the background value.(package private) voidRemoves the NaN value which has been reserved for a qualitative category.Methods inherited from class java.util.HashSet
add, clone, contains, isEmpty, iterator, remove, size, spliteratorMethods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Field Details
-
background
Number backgroundThe value which should be assigned ordinal 0 if that ordinal value is available. For performance reason, the background value should be assigned ordinal 0 when possible. This isnullif unspecified.
-
-
Constructor Details
-
ToNaN
ToNaN()To be constructed only from this package.
-
-
Method Details
-
clear
public void clear()Sets this function to the same state than after construction. This method is invoked when the same builder is reused for creating many sample dimensions. -
isBackground
private boolean isBackground(double value) Returnstrueif the specified value is the background value. -
applyAsInt
public int applyAsInt(double value) Mapping from sample values to ordinal values to be supplied toMathFunctions.toNanFloat(int). That mapping shall ensure that there are no ordinal value collisions between different categories in the sameSampleDimension.- Specified by:
applyAsIntin interfaceDoubleToIntFunction- Parameters:
value- a real number in theCategory.rangesample value range.- Returns:
- a value between -2097152 and 2097151 inclusive.
-
remove
Removes the NaN value which has been reserved for a qualitative category. This method does nothing ifconvertedis not a NaN value, i.e. if the category is quantitative instead of qualitative.- Parameters:
c- the presumed qualitative category.
-