Class ArrayVector.UnsignedBytes
- All Implemented Interfaces:
Serializable,Iterable<Number>,Collection<Number>,List<Number>,RandomAccess,CheckedContainer<Byte>
- Enclosing class:
- ArrayVector<E extends Number>
byte[] 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 longFor cross-version compatibility.Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbytebyteValue(int index) Returns the value at the given index as abyte.doubledoubleValue(int index) Returns the value at the given index as adouble.floatfloatValue(int index) Returns the value at the given index as afloat.get(int index) Unconditionally uses a larger type since the value may exceed byte capacity.intintValue(int index) Returns the value at the given index as anint.booleanDeclares this vector as unsigned.longlongValue(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.shortshortValue(int index) Returns the value at the given index as ashort.stringValue(int index) Returns the string representation at the given index.(package private) voidverifyType(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.Bytes
buffer, equals, fill, getElementType, hashCode, indexOf, isEmptyOrNaN, isInteger, isSinglePrecision, set, sizeMethods inherited from class org.apache.sis.math.ArrayVector
compress, compress, isNaN, newInstanceMethods inherited from class org.apache.sis.math.Vector
backingVector, compress, concatenate, copy, create, create, createConcatenate, createForDecimal, createSequence, createSequence, createSubSampling, createTransform, doubleValues, equals, floatValues, increment, pick, range, repeat, repetitions, reverse, 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:
-
-
Constructor Details
-
UnsignedBytes
UnsignedBytes(byte[] array) Creates a new vector for the given array.
-
-
Method Details
-
isUnsigned
public boolean isUnsigned()Declares this vector as unsigned.- Overrides:
isUnsignedin classVector- Returns:
trueif the integer values shall be interpreted as unsigned values.
-
doubleValue
public double doubleValue(int index) Description copied from class:VectorReturns the value at the given index as adouble. This is the safest method since all primitive types supported byVectorare convertible to thedoubletype.- Overrides:
doubleValuein classArrayVector.Bytes- 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:VectorReturns 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 thedoubletype.The default implementation delegates to
Vector.doubleValue(int)and cast the result tofloat.- Overrides:
floatValuein classArrayVector.Bytes- 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:VectorReturns 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 alongwith an error not greater than 0.5. Subclasses that store or compute their values with an integer type should override this method.- Overrides:
longValuein classArrayVector.Bytes- 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:VectorReturns 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 theinttype. Subclasses that store or compute their values with theint,shortorbytetype should override this method.- Overrides:
intValuein classArrayVector.Bytes- Parameters:
index- the index in the [0 … size-1] range.- Returns:
- the value at the given index.
-
shortValue
public short shortValue(int index) Description copied from class:VectorReturns the value at the given index as ashort. 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 theshorttype. Subclasses that store or compute their values with theshortorbytetype should override this method.- Overrides:
shortValuein classArrayVector.Bytes- Parameters:
index- the index in the [0 … size-1] range.- Returns:
- the value at the given index.
-
byteValue
public byte byteValue(int index) Description copied from class:VectorReturns the value at the given index as abyte. 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 thebytetype. Subclasses that store or compute their values with thebytetype should override this method.- Overrides:
byteValuein classArrayVector.Bytes- 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 byte capacity. -
verifyType
Verifies that the given value can be stored as an unsigned integer.- Overrides:
verifyTypein classArrayVector<Byte>
-
stringValue
Returns the string representation at the given index.- Overrides:
stringValuein classArrayVector.Bytes- 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:
rangein classArrayVector.Bytes- Parameters:
indices- supplier of indices of the values to examine for computing the range, ornullfor 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.
-