Package org.apache.sis.math
Class ArrayVector.Doubles
java.lang.Object
- All Implemented Interfaces:
Serializable
,Iterable<Number>
,Collection<Number>
,List<Number>
,RandomAccess
,SequencedCollection<Number>
,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 long
For 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.double
doubleValue
(int index) Returns the value at the given index.double[]
Returns a copy of current data as a floating point array.(package private) boolean
Returns whether this vector in the given range is equal to the specified vector.void
Sets the value of all elements in the given range.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 thedouble
value 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.int
hashCode()
Applies hash code contract specifiedVector.hashCode()
.(package private) int
indexOf
(int toSearch, int index, boolean equality) Finds index of a match or mismatch (depending onequality
).boolean
Returnstrue
if this vector is empty or contains onlyNaN
values.boolean
isNaN
(int index) Returnstrue
if the value at the given index isNaN
.boolean
Returns whether values are convertible tofloat
type.(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.int
size()
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, verifyType
Methods 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, warning
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, addFirst, addLast, contains, containsAll, getFirst, getLast, isEmpty, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, 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:
getElementType
in interfaceCheckedContainer<Double>
- Specified by:
getElementType
in classVector
- Returns:
- the type of elements in this vector.
- See Also:
-
isSinglePrecision
public boolean isSinglePrecision()Returns whether values are convertible tofloat
type.- Overrides:
isSinglePrecision
in classVector
- Returns:
- whether values in this vector can be casted to
float
primitive type. - See Also:
-
size
public int size()Returns the length of the backing array. -
isNaN
public boolean isNaN(int index) Returnstrue
if the value at the given index isNaN
.- Overrides:
isNaN
in classArrayVector<Double>
- Parameters:
index
- the index in the [0 … size-1] range.- Returns:
true
if the value at the given index isNaN
.
-
stringValue
Returns the string representation at the given index.- Specified by:
stringValue
in 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:
doubleValue
in 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 thedouble
value was too small or too large).- Overrides:
floatValue
in 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:
indexOf
in 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()Returnstrue
if this vector is empty or contains onlyNaN
values.- Overrides:
isEmptyOrNaN
in classVector
- Returns:
- whether this vector is empty or contains only
NaN
values.
-
equals
Returns whether this vector in the given range is equal to the specified vector.- Overrides:
equals
in 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:
doubleValues
in 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:
floatValues
in classVector
- Returns:
- a copy of all floating point values in this vector.
- See Also:
-
hashCode
public int hashCode()Applies hash code contract specifiedVector.hashCode()
.
-