Package org.apache.sis.math
Class ArrayVector.UnsignedIntegers
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<Number>
org.apache.sis.math.Vector
org.apache.sis.math.ArrayVector<Integer>
org.apache.sis.math.ArrayVector.Integers
org.apache.sis.math.ArrayVector.UnsignedIntegers
- All Implemented Interfaces:
Serializable
,Iterable<Number>
,Collection<Number>
,List<Number>
,RandomAccess
,CheckedContainer<Integer>
- Enclosing class:
- ArrayVector<E extends Number>
A vector backed by an array of type
int[]
to be interpreted as unsigned values.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.math.ArrayVector
ArrayVector.Decimal, ArrayVector.Doubles
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
For cross-version compatibility.Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
doubleValue
(int index) Returns the value at the given index as adouble
.float
floatValue
(int index) Returns the value at the given index as afloat
.get
(int index) Unconditionally uses a larger type since the value may exceed integer capacity.int
intValue
(int index) Returns the value at the given index as anint
.boolean
Declares this vector as unsigned.long
longValue
(int index) Returns the value at the given index as along
.(package private) NumberRange<?>
range
(IntSupplier indices, int n) Finds the minimum and maximum values in the array or in a subset of the array.stringValue
(int index) Returns the string representation at the given index.(package private) void
verifyType
(Number value, byte expected) Verifies that the given value can be stored as an unsigned integer.Methods inherited from class org.apache.sis.math.ArrayVector.Integers
buffer, equals, fill, getElementType, hashCode, increment, indexOf, isEmptyOrNaN, isInteger, isSinglePrecision, set, size
Methods inherited from class org.apache.sis.math.ArrayVector
compress, compress, isNaN, newInstance
Methods inherited from class org.apache.sis.math.Vector
backingVector, byteValue, compress, concatenate, copy, create, create, createConcatenate, createForDecimal, createSequence, createSequence, createSubSampling, createTransform, doubleValues, equals, floatValues, 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, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
-
Constructor Details
-
UnsignedIntegers
UnsignedIntegers(int[] array) Creates a new vector for the given array.
-
-
Method Details
-
isUnsigned
public boolean isUnsigned()Declares this vector as unsigned.- Overrides:
isUnsigned
in classVector
- Returns:
true
if the integer values shall be interpreted as unsigned values.
-
doubleValue
public double doubleValue(int index) Description copied from class:Vector
Returns the value at the given index as adouble
. This is the safest method since all primitive types supported byVector
are convertible to thedouble
type.- Overrides:
doubleValue
in classArrayVector.Integers
- 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) Description copied from class:Vector
Returns the value at the given index as afloat
. This method may result in a lost of precision if this vector stores or computes its values with thedouble
type.The default implementation delegates to
Vector.doubleValue(int)
and cast the result tofloat
.- Overrides:
floatValue
in classArrayVector.Integers
- Parameters:
index
- the index in the [0 … size-1] range.- Returns:
- the value at the given index.
- See Also:
-
longValue
public long longValue(int index) Description copied from class:Vector
Returns the value at the given index as along
. If this vector uses floating point values, the value is rounded to the nearest integer.The default implementation delegates to
Vector.doubleValue(int)
and verifies if the result can be rounded to along
with an error not greater than 0.5. Subclasses that store or compute their values with an integer type should override this method.- Overrides:
longValue
in classArrayVector.Integers
- Parameters:
index
- the index in the [0 … size-1] range.- Returns:
- the value at the given index.
-
intValue
public int intValue(int index) Description copied from class:Vector
Returns the value at the given index as anint
. If this vector uses floating point values, the value is rounded to the nearest integer.The default implementation delegates to
Vector.longValue(int)
and verifies if the result fits in theint
type. Subclasses that store or compute their values with theint
,short
orbyte
type should override this method.- Overrides:
intValue
in classArrayVector.Integers
- Parameters:
index
- the index in the [0 … size-1] range.- Returns:
- the value at the given index.
-
get
Unconditionally uses a larger type since the value may exceed integer capacity. -
verifyType
Verifies that the given value can be stored as an unsigned integer.- Overrides:
verifyType
in classArrayVector<Integer>
-
stringValue
Returns the string representation at the given index.- Overrides:
stringValue
in classArrayVector.Integers
- 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:
-
range
Finds the minimum and maximum values in the array or in a subset of the array.- Overrides:
range
in classArrayVector.Integers
- Parameters:
indices
- supplier of indices of the values to examine for computing the range, ornull
for the 0, 1, 2, … n-1 sequence.n
- number of indices to get from the supplier.- Returns:
- the range of all values at the given indices.
-