E
- type of this 1D matrixpublic interface Matrix1D<E> extends Iterable<E>
long
s.Modifier and Type | Method and Description |
---|---|
E |
aggregate(BinaryFunction<E,E,E> aggr,
UnaryFunction<E,E> function)
Apply a function to each value in this 1D matrix and aggregate
the result.
|
E |
aggregate(Matrix1D<? extends E> other,
BinaryFunction<E,E,E> aggr,
BinaryFunction<E,E,E> function)
Apply a function to each value in this 1D matrix and the specified
matrix and aggregate the result.
|
Matrix1D<E> |
assign(E e)
Assign all values in this 1D matrix to
e (optional operation). |
Matrix1D<E> |
assign(Matrix1D<? extends E> other)
Assign all values in this 1D matrix to the values in the
specified matrix (optional operation).
|
Matrix1D<E> |
assign(Matrix1D<? extends E> other,
BinaryFunction<E,E,E> function)
Assign the result of the specified function of a value from
this 1D matrix and the specified matrix to each value in this
1D matrix (optional operation).
|
Matrix1D<E> |
assign(UnaryFunction<E,E> function)
Assign the result of the specified function to each value
in this 1D matrix (optional operation).
|
long |
cardinality()
Return the cardinality of this 1D matrix, the number
of non-null values.
|
void |
clear()
Clear all the values in this 1D matrix (optional operation).
|
void |
forEach(BinaryPredicate<Long,? super E> predicate,
BinaryProcedure<Long,? super E> procedure)
Apply the specified procedures to each index and value in this
1D matrix accepted by the specified predicate.
|
void |
forEach(BinaryProcedure<Long,? super E> procedure)
Apply the specified procedures to each index and value in this
1D matrix.
|
void |
forEach(UnaryPredicate<? super E> predicate,
UnaryProcedure<? super E> procedure)
Apply the specified procedure to each value in this 1D matrix
accepted by the specified predicate.
|
void |
forEach(UnaryProcedure<? super E> procedure)
Apply the specified procedure to each value in this 1D matrix.
|
void |
forEachNonNull(UnaryProcedure<? super E> procedure)
Apply the specified procedure to each non-null value in this 1D matrix.
|
E |
get(long index)
Return the value at the specified index.
|
E |
getQuick(long index)
Return the value at the specified index without checking bounds.
|
boolean |
isEmpty()
Return true if the cardinality of this 1D matrix is zero.
|
Iterator<E> |
iterator()
Return an iterator over the values in this 1D matrix, including
null s. |
void |
set(long index,
E e)
Set the value at the specified index to
e (optional operation). |
void |
setQuick(long index,
E e)
Set the value at the specified index to
e without
checking bounds (optional operation). |
long |
size()
Return the size of this 1D matrix.
|
Matrix1D<E> |
viewFlip()
Return a new 1D matrix flip view.
|
Matrix1D<E> |
viewPart(long index,
long width)
Return a new 1D matrix sub-range view that contains only those values
from index
index to index + width - 1 . |
Matrix1D<E> |
viewSelection(BitMatrix1D mask)
Return a new 1D matrix selection view that contains only those values
at the indices present in the specified bit mask.
|
Matrix1D<E> |
viewSelection(long[] indices)
Return a new 1D matrix selection view that contains only those values
at the specified indices.
|
Matrix1D<E> |
viewSelection(UnaryPredicate<E> predicate)
Return a new 1D matrix selection view that contains only those values
selected by the specified predicate.
|
Matrix1D<E> |
viewStrides(long stride)
Return a new 1D matrix stride view which is a sub matrix
consisting of every i-th value in this matrix.
|
long size()
long cardinality()
boolean isEmpty()
void clear()
UnsupportedOperationException
- if the clear
operation
is not supported by this 1D matrixE get(long index)
index
- index, must be >= 0
and < size()
IndexOutOfBoundsException
- if index
is negative
or if index
is greater than or equal to size()
E getQuick(long index)
index
- index, should be >= 0
and < size()
(unchecked)void set(long index, E e)
e
(optional operation).index
- index, must be >= 0
and < size()
e
- valueIndexOutOfBoundsException
- if index
is negative
or if index
is greater than or equal to size()
UnsupportedOperationException
- if the set
operation
is not supported by this 1D matrixvoid setQuick(long index, E e)
e
without
checking bounds (optional operation).index
- index, should be >= 0
and < size()
(unchecked)e
- valueUnsupportedOperationException
- if the setQuick
operation
is not supported by this 1D matrixIterator<E> iterator()
null
s.Matrix1D<E> assign(E e)
e
(optional operation).e
- valueUnsupportedOperationException
- if this assign
operation
is not supported by this 1D matrixMatrix1D<E> assign(UnaryFunction<E,E> function)
function
- function, must not be nullUnsupportedOperationException
- if this assign
operation
is not supported by this 1D matrixMatrix1D<E> assign(Matrix1D<? extends E> other)
other
- other 1D matrix, must not be null and must
be the same size as this 1D matrixUnsupportedOperationException
- if this assign
operation
is not supported by this 1D matrixMatrix1D<E> assign(Matrix1D<? extends E> other, BinaryFunction<E,E,E> function)
other
- other 1D matrix, must not be null and must
be the same size as this 1D matrixfunction
- function, must not be nullUnsupportedOperationException
- if this assign
operation
is not supported by this 1D matrixE aggregate(BinaryFunction<E,E,E> aggr, UnaryFunction<E,E> function)
aggr
- aggregate function, must not be nullfunction
- function, must not be nullE aggregate(Matrix1D<? extends E> other, BinaryFunction<E,E,E> aggr, BinaryFunction<E,E,E> function)
other
- other 1D matrix, must not be null and must
be the same size as this 1D matrixaggr
- aggregate function, must not be nullfunction
- function, must not be nullMatrix1D<E> viewFlip()
0
is now index size() - 1
, ..., what used to
be index size() - 1
is now index 0
. The
view is backed by this matrix, so changes made to the returned view
are reflected in this matrix, and vice-versa.Matrix1D<E> viewPart(long index, long width)
index
to index + width - 1
.
The view is backed by this matrix, so changes made to the returned
view are reflected in this matrix, and vice-versa.index
- index, must be >= 0
and < size()
width
- widthindex
to index + width - 1
Matrix1D<E> viewSelection(long[] indices)
indices
- indicesMatrix1D<E> viewSelection(UnaryPredicate<E> predicate)
predicate
- predicate, must not be nullMatrix1D<E> viewSelection(BitMatrix1D mask)
mask
- 1D bit mask, must not be nullMatrix1D<E> viewStrides(long stride)
stride
- stride, must be > 0
IndexOutOfBoundsException
- if stride
is
negative or zerovoid forEach(UnaryProcedure<? super E> procedure)
For example:
Matrix1D<String> m; m.forEach(new UnaryProcedure<String>() { public void run(final String value) { System.out.println(value); } });
procedure
- procedure, must not be nullvoid forEach(UnaryPredicate<? super E> predicate, UnaryProcedure<? super E> procedure)
For example:
Matrix1D<String> m; m.forEach(new UnaryPredicate<String>() { public boolean test(final String value) { return (value != null); } }, new UnaryProcedure<String>() { public void run(final String value) { System.out.println(value); } });
predicate
- predicate, must not be nullprocedure
- procedure, must not be nullvoid forEachNonNull(UnaryProcedure<? super E> procedure)
For example:
Matrix1D<String> m; m.forEachNonNull(new UnaryProcedure<String>() { public void run(final String value) { System.out.println(value); } });
procedure
- procedure, must not be nullvoid forEach(BinaryProcedure<Long,? super E> procedure)
For example:
Matrix1D<String> m; m.forEach(new BinaryProcedure<Long, String>() { public void run(final Long index, final String value) { System.out.print("m[" + index + "]=" + value); } });
procedure
- procedure, must not be nullvoid forEach(BinaryPredicate<Long,? super E> predicate, BinaryProcedure<Long,? super E> procedure)
For example:
Matrix1D<String> m; m.forEach(new BinaryPredicate<Long, String>() { public boolean test(final Long index, final String value) { return (value != null); } }, new BinaryProcedure<Long, String>() { public void run(final Long index, final String value) { System.out.print("m[" + index + "]=" + value); } });
predicate
- predicate, must not be nullprocedure
- procedure, must not be nullCopyright (c) 2004-2013 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).