Package org.apache.sis.math
Class ConcatenatedVector
- All Implemented Interfaces:
Serializable
,Iterable<Number>
,Collection<Number>
,List<Number>
,RandomAccess
,SequencedCollection<Number>
A vector which is the concatenation of two other vectors.
- Since:
- 0.8
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Vector
The vectors to concatenate.private final int
The length of the first vector.private final Vector
The vectors to concatenate.private static final long
For cross-version compatibility.Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionConcatenatedVector
(Vector first, Vector second) Creates a concatenated vector. -
Method Summary
Modifier and TypeMethodDescriptionbyte
byteValue
(int index) Returns the value at the given index.(package private) Vector
createConcatenate
(Vector toAppend) Delegates to the backing vectors since there is a chance that they override theirconcatenate
method with a more efficient implementation.(package private) Vector
createSubSampling
(int first, int step, int length) Delegates to the backing vectors if possible.(package private) Vector
createTransform
(double scale, double offset) Delegates to the backing vectors since there is a chance that they override theirtransform
method with a more efficient implementation.double
doubleValue
(int index) Returns the value at the given index.void
Sets a range of elements to the given number.float
floatValue
(int index) Returns the value at the given index.get
(int index) Returns the value at the given index.Returns the parent type of the two vectors.increment
(double tolerance) Returns the increment between all consecutive values if this increment is constant, ornull
otherwise.int
intValue
(int index) Returns the value at the given index.boolean
Returnstrue
if this vector is empty or contains onlyNaN
values.boolean
Returnstrue
if this vector contains only integer values.boolean
isNaN
(int index) Returnstrue
if the value at the given index isNaN
.boolean
Returnstrue
only if both vectors are unsigned.long
longValue
(int index) Returns the value at the given index.NumberRange
<?> range()
Computes the minimal and maximal values in this vector.Sets the value at the given index.short
shortValue
(int index) Returns the value at the given index.int
size()
Returns the length of this vector.stringValue
(int index) Returns the string representation at the given index.Methods inherited from class org.apache.sis.math.Vector
backingVector, buffer, compress, concatenate, copy, create, create, createForDecimal, createSequence, createSequence, doubleValues, equals, equals, floatValues, hashCode, indexOf, isSinglePrecision, pick, range, repeat, repetitions, reverse, 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:
-
first
The vectors to concatenate. -
second
The vectors to concatenate. -
limit
private final int limitThe length of the first vector.
-
-
Constructor Details
-
ConcatenatedVector
Creates a concatenated vector.- Parameters:
first
- the vector for the lower indices.second
- the vector for the higher indices.
-
-
Method Details
-
getElementType
Returns the parent type of the two vectors.- Specified by:
getElementType
in classVector
- Returns:
- the type of elements in this vector.
- See Also:
-
isInteger
public boolean isInteger()Returnstrue
if this vector contains only integer values. -
isUnsigned
public boolean isUnsigned()Returnstrue
only if both vectors are unsigned.- Overrides:
isUnsigned
in classVector
- Returns:
true
if the integer values shall be interpreted as unsigned values.
-
size
public int size()Returns the length of this vector. -
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.
-
isNaN
Returnstrue
if the value at the given index isNaN
.- Specified by:
isNaN
in classVector
- Parameters:
index
- the index in the [0 … size-1] range.- Returns:
true
if the value at the given index isNaN
.- Throws:
IndexOutOfBoundsException
- if the given index is out of bounds.
-
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 at the given index.- Overrides:
floatValue
in classVector
- 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) Returns the value at the given index. -
intValue
public int intValue(int index) Returns the value at the given index. -
shortValue
public short shortValue(int index) Returns the value at the given index.- Overrides:
shortValue
in classVector
- Parameters:
index
- the index in the [0 … size-1] range.- Returns:
- the value at the given index.
-
byteValue
public byte byteValue(int index) Returns the value at the given index. -
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:
-
get
Returns the value at the given index. -
set
Sets the value at the given index. -
fill
Sets a range of elements to the given number. -
increment
Returns the increment between all consecutive values if this increment is constant, ornull
otherwise. -
range
Computes the minimal and maximal values in this vector. This is the union of the range of the two concatenated vectors. -
createSubSampling
Delegates to the backing vectors if possible.- Overrides:
createSubSampling
in classVector
-
createConcatenate
Delegates to the backing vectors since there is a chance that they override theirconcatenate
method with a more efficient implementation.- Overrides:
createConcatenate
in classVector
-
createTransform
Delegates to the backing vectors since there is a chance that they override theirtransform
method with a more efficient implementation.- Overrides:
createTransform
in classVector
-