Package org.apache.sis.math
Class ArrayVector<E extends Number>
- Type Parameters:
E- the base type of elements in the vector.
- All Implemented Interfaces:
Serializable,Iterable<Number>,Collection<Number>,List<Number>,RandomAccess,CheckedContainer<E>
- Direct Known Subclasses:
ArrayVector.ASCII,ArrayVector.Bytes,ArrayVector.Doubles,ArrayVector.Floats,ArrayVector.Integers,ArrayVector.Longs,ArrayVector.Raw,ArrayVector.Shorts,PackedVector
abstract class ArrayVector<E extends Number>
extends Vector
implements CheckedContainer<E>, Serializable
A vector backed by an array of a primitive type. This class does not copy the array,
so changes in the underlying array is reflected in this vector and vice-versa.
- Since:
- 0.8
- Version:
- 1.2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classA vector backed by an array of typeString[].private static classA vector backed by an array of typebyte[].(package private) static final classA vector backed by an array of typefloat[]to be converted todoublein a way that minimizes the errors when represented in base 10.(package private) static final classA vector backed by an array of typedouble[].private static classA vector backed by an array of typefloat[].private static classA vector backed by an array of typeint[].private static classA vector backed by an array of typelong[].private static final classA vector backed by an array of typeNumber[].private static classA vector backed by an array of typeshort[].private static final classA vector backed by an array of typebyte[]to be interpreted as unsigned values.private static final classA vector backed by an array of typeint[]to be interpreted as unsigned values.private static final classA vector backed by an array of typelong[]to be interpreted as unsigned values.private static final classA vector backed by an array of typeshort[]to be interpreted as unsigned values. -
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 TypeMethodDescription(package private) static VectorReturns a vector with the same data than the given vector but encoded in a more compact way, ornullif this method cannot do better than the givenVectorinstance.(package private) static VectorReturns a vector with the same data than the given vector but encoded in a more compact way, ornullif this method cannot do better than the givenVectorinstance.booleanisNaN(int index) Default implementation for the convenience of wrapper of integer types.(package private) static VectornewInstance(Object array, boolean isUnsigned) Creates a new instance.(package private) voidverifyType(Number value, byte expected) Verifies that the given value can be casted to the expected type.Methods inherited from class org.apache.sis.math.Vector
backingVector, buffer, byteValue, compress, concatenate, copy, create, create, createConcatenate, createForDecimal, createSequence, createSequence, createSubSampling, createTransform, doubleValue, doubleValues, equals, equals, fill, floatValue, floatValues, get, getElementType, hashCode, increment, indexOf, intValue, isEmptyOrNaN, isInteger, isSinglePrecision, isUnsigned, longValue, pick, range, range, repeat, repetitions, reverse, set, shortValue, size, stringValue, 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 org.apache.sis.util.collection.CheckedContainer
getElementTypeMethods 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
-
ArrayVector
ArrayVector()For sub-classes constructor.
-
-
Method Details
-
newInstance
Creates a new instance.- Throws:
IllegalArgumentException- if the type of the given object is not recognized by the method.
-
compress
Returns a vector with the same data than the given vector but encoded in a more compact way, ornullif this method cannot do better than the givenVectorinstance. This method shall be invoked only for vector of integer values (this is not verified). -
compress
Returns a vector with the same data than the given vector but encoded in a more compact way, ornullif this method cannot do better than the givenVectorinstance. This method shall be invoked only for vector of floating point values (this is not verified). -
isNaN
public boolean isNaN(int index) Default implementation for the convenience of wrapper of integer types. -
verifyType
Verifies that the given value can be casted to the expected type. The expected type must be one of theNumbersconstants.
-