Package org.apache.sis.math
Class ArrayVector.Doubles
java.lang.Object
- All Implemented Interfaces:
Serializable,Iterable<Number>,Collection<Number>,List<Number>,RandomAccess,CheckedContainer<Double>
- Enclosing class:
- ArrayVector<E extends Number>
A vector backed by an array of type
double[].-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.math.ArrayVector
ArrayVector.Decimal, ArrayVector.Doubles -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final double[]The backing array.private static final longFor cross-version compatibility.Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuffer()Wraps this vector in a buffer.doubledoubleValue(int index) Returns the value at the given index.double[]Returns a copy of current data as a floating point array.(package private) booleanReturns whether this vector in the given range is equal to the specified vector.voidSets the value of all elements in the given range.floatfloatValue(int index) Returns the value casted as afloat, since we may loose precision but the result of the cast is not completely wrong (at worst we get zero of infinity values if the magnitude of thedoublevalue was too small or too large).float[]Returns a copy of current data as a floating point array.get(int index) Returns the value at the given index.Returns the type of elements in the backing array.inthashCode()Applies hash code contract specifiedVector.hashCode().(package private) intindexOf(int toSearch, int index, boolean equality) Finds index of a match or mismatch (depending onequality).booleanReturnstrueif this vector is empty or contains onlyNaNvalues.booleanisNaN(int index) Returnstrueif the value at the given index isNaN.booleanReturns whether values are convertible tofloattype.(package private) NumberRange<Double>range(IntSupplier indices, int n) Finds the minimum and maximum values in the array or in a subset of the array.Sets the value at the given index.intsize()Returns the length of the backing array.stringValue(int index) Returns the string representation at the given index.Methods inherited from class org.apache.sis.math.ArrayVector
compress, compress, newInstance, verifyTypeMethods inherited from class org.apache.sis.math.Vector
backingVector, byteValue, compress, concatenate, copy, create, create, createConcatenate, createForDecimal, createSequence, createSequence, createSubSampling, createTransform, equals, increment, intValue, isInteger, isUnsigned, longValue, pick, range, repeat, repetitions, reverse, shortValue, subList, subSampling, subtract, toBacking, toString, transform, warningMethods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRangeMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
array
private final double[] arrayThe backing array.
-
-
Constructor Details
-
Doubles
Doubles(double[] array) Creates a new vector for the given array.
-
-
Method Details
-
getElementType
Returns the type of elements in the backing array.- Specified by:
getElementTypein interfaceCheckedContainer<Double>- Specified by:
getElementTypein classVector- Returns:
- the type of elements in this vector.
- See Also:
-
isSinglePrecision
public boolean isSinglePrecision()Returns whether values are convertible tofloattype.- Overrides:
isSinglePrecisionin classVector- Returns:
- whether values in this vector can be casted to
floatprimitive type. - See Also:
-
size
public int size()Returns the length of the backing array. -
isNaN
public boolean isNaN(int index) Returnstrueif the value at the given index isNaN.- Overrides:
isNaNin classArrayVector<Double>- Parameters:
index- the index in the [0 … size-1] range.- Returns:
trueif the value at the given index isNaN.
-
stringValue
Returns the string representation at the given index.- Specified by:
stringValuein classVector- Parameters:
index- the index in the [0 … size-1] range.- Returns:
- a string representation of the value at the given index (may be
null). - See Also:
-
doubleValue
public double doubleValue(int index) Returns the value at the given index.- Specified by:
doubleValuein classVector- Parameters:
index- the index in the [0 … size-1] range.- Returns:
- the value at the given index.
- See Also:
-
floatValue
public float floatValue(int index) Returns the value casted as afloat, since we may loose precision but the result of the cast is not completely wrong (at worst we get zero of infinity values if the magnitude of thedoublevalue was too small or too large).- Overrides:
floatValuein classVector- Parameters:
index- the index in the [0 … size-1] range.- Returns:
- the value at the given index.
- See Also:
-
get
Returns the value at the given index. -
set
Sets the value at the given index. -
fill
Sets the value of all elements in the given range. -
indexOf
int indexOf(int toSearch, int index, boolean equality) Finds index of a match or mismatch (depending onequality).- Overrides:
indexOfin classVector- Parameters:
toSearch- index of the value to search.index- index of the first value where to start the search.equality- whether we search the first equal value, or the first different value.- Returns:
- index of the value found, or the vector size if the value has not been found.
-
isEmptyOrNaN
public boolean isEmptyOrNaN()Returnstrueif this vector is empty or contains onlyNaNvalues.- Overrides:
isEmptyOrNaNin classVector- Returns:
- whether this vector is empty or contains only
NaNvalues.
-
equals
Returns whether this vector in the given range is equal to the specified vector.- Overrides:
equalsin classVector- Parameters:
lower- index of the first value to compare in this vector, inclusive.upper- index after the last value to compare in this vector.other- the other vector to compare values with this vector. May bethis.otherOffset- index of the first element to compare in the other vector.- Returns:
- whether values over the specified range of the two vectors are equal.
-
range
Finds the minimum and maximum values in the array or in a subset of the array. -
buffer
Wraps this vector in a buffer. -
doubleValues
public double[] doubleValues()Returns a copy of current data as a floating point array.- Overrides:
doubleValuesin classVector- Returns:
- a copy of all floating point values in this vector.
- See Also:
-
floatValues
public float[] floatValues()Returns a copy of current data as a floating point array.- Overrides:
floatValuesin classVector- Returns:
- a copy of all floating point values in this vector.
- See Also:
-
hashCode
public int hashCode()Applies hash code contract specifiedVector.hashCode().
-