E
- type of this abstract 3D matrixabstract class AbstractMatrix3D<E> extends Object implements Matrix3D<E>
Modifier and Type | Field and Description |
---|---|
protected long |
columns
Number of columns.
|
protected long |
columnStride
Number of columns between elements.
|
protected long |
columnZero
Column of the first element.
|
protected boolean |
isView
True if this instance is a view.
|
protected long |
rows
Number of rows.
|
protected long |
rowStride
Number of rows between elements.
|
protected long |
rowZero
Row of the first element.
|
protected long |
slices
Number of slices.
|
protected long |
sliceStride
Number of slices between elements.
|
protected long |
sliceZero
Slice of the first element.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractMatrix3D()
Protected no-arg constructor, to support serialization.
|
protected |
AbstractMatrix3D(long slices,
long rows,
long columns)
Create a new abstract 3D matrix with the specified number of
slices, rows, and columns.
|
protected |
AbstractMatrix3D(long slices,
long rows,
long columns,
long sliceZero,
long rowZero,
long columnZero,
long sliceStride,
long rowStride,
long columnStride,
boolean isView)
Create a new abstract 3D matrix with the specified parameters.
|
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 3D matrix and aggregate
the result.
|
E |
aggregate(Matrix3D<? extends E> other,
BinaryFunction<E,E,E> aggr,
BinaryFunction<E,E,E> function)
Apply a function to each value in this 3D matrix and the specified
matrix and aggregate the result.
|
Matrix3D<E> |
assign(E e)
Assign all values in this 3D matrix to
e (optional
operation). |
Matrix3D<E> |
assign(Matrix3D<? extends E> other)
Assign all values in this 3D matrix to the values in the
specified matrix (optional operation).
|
Matrix3D<E> |
assign(Matrix3D<? extends E> other,
BinaryFunction<E,E,E> function)
Assign the result of the specified function of a value from
this 3D matrix and the specified matrix to each value in this
3D matrix (optional operation).
|
Matrix3D<E> |
assign(UnaryFunction<E,E> function)
Assign the result of the specified function to each value
in this 3D matrix (optional operation).
|
long |
cardinality()
Return the cardinality of this 3D matrix, the number
of non-null values.
|
void |
clear()
Clear all the values in this 3D matrix (optional operation).
|
long |
columns()
Return the number of columns in this 3D matrix.
|
protected long |
columnStride()
Return the number of columns between two elements.
|
protected long |
columnZero()
Return the column of the first element.
|
void |
forEach(QuaternaryPredicate<Long,Long,Long,? super E> predicate,
QuaternaryProcedure<Long,Long,Long,? super E> procedure)
Apply the specified procedure to each slice, row, and column
and to each value in this 3D matrix accepted by the specified predicate.
|
void |
forEach(QuaternaryProcedure<Long,Long,Long,? super E> procedure)
Apply the specified procedure to each slice, row, and column and
to each value in this 3D matrix.
|
void |
forEach(UnaryPredicate<? super E> predicate,
UnaryProcedure<? super E> procedure)
Apply the specified procedure to each value in this 3D matrix
accepted by the specified predicate.
|
void |
forEach(UnaryProcedure<? super E> procedure)
Apply the specified procedure to each value in this 3D matrix.
|
void |
forEachNonNull(UnaryProcedure<? super E> procedure)
Apply the specified procedure to each non-null value in this 3D matrix.
|
E |
get(long slice,
long row,
long column)
Return the value at the specified slice, row, and column.
|
boolean |
isEmpty()
Return true if the cardinality of this 3D matrix is zero.
|
protected boolean |
isView()
Return true if this instance is a view.
|
Iterator<E> |
iterator()
Return an iterator over the values in this 3D matrix, including
null s. |
long |
rows()
Return the number of rows in this 3D matrix.
|
protected long |
rowStride()
Return the number of rows between two elements.
|
protected long |
rowZero()
Return the row of the first element.
|
void |
set(long slice,
long row,
long column,
E e)
Set the value at the specified slice, row, and column to
e
(optional operation). |
void |
setQuick(long slice,
long row,
long column,
E e)
Set the value at the specified slice, row, and column to
e without checking bounds (optional operation). |
long |
size()
Return the size of this 3D matrix.
|
long |
slices()
Return the number of slices in this 3D matrix.
|
protected long |
sliceStride()
Return the number of slices between two elements.
|
protected long |
sliceZero()
Return the slice of the first element.
|
protected AbstractMatrix3D<E> |
vColumnFlip()
Self-modifying version of
viewColumnFlip() . |
protected AbstractMatrix3D<E> |
vDice(int axis0,
int axis1,
int axis2)
Self-modifying version of
viewDice(int, int, int) . |
protected AbstractMatrix3D<E> |
view()
Create a new view.
|
Matrix3D<E> |
viewColumnFlip()
Return a new 3D matrix flip view along the column axis.
|
Matrix3D<E> |
viewDice(int axis0,
int axis1,
int axis2)
Return a new 3D matrix dice (transposition) view.
|
Matrix3D<E> |
viewPart(long slice,
long row,
long column,
long depth,
long height,
long width)
Return a new 3D matrix sub-range view that contains only those values
from
(slice, row, column) to
(slice + depth - 1, row + height - 1, column + width - 1) . |
Matrix3D<E> |
viewRowFlip()
Return a new 3D matrix flip view along the row axis.
|
Matrix3D<E> |
viewSelection(BitMatrix3D mask)
Return a new 3D matrix selection view that contains only those values
at the indices present in the specified bit mask.
|
Matrix3D<E> |
viewSelection(long[] sliceIndices,
long[] rowIndices,
long[] columnIndices)
Return a new 3D matrix selection view that contains only those values
at the specified indices.
|
Matrix3D<E> |
viewSelection(UnaryPredicate<Matrix2D<E>> predicate)
Return a new 3D matrix selection view that contains only those slices
selected by the specified predicate.
|
Matrix3D<E> |
viewSliceFlip()
Return a new 3D matrix flip view along the slice axis.
|
Matrix3D<E> |
viewStrides(long sliceStride,
long rowStride,
long columnStride)
Return a new 3D matrix stride view which is a sub matrix consisting
of every
sliceStride -th slice, every rowStride -th
row, and every columnStride -th column. |
protected AbstractMatrix3D<E> |
vPart(long slice,
long row,
long column,
long depth,
long height,
long width)
Self-modifying version of
viewPart(long, long, long, long, long, long) . |
protected AbstractMatrix3D<E> |
vRowFlip()
Self-modifying version of
viewRowFlip() . |
protected AbstractMatrix3D<E> |
vSliceFlip()
Self-modifying version of
viewSliceFlip() . |
protected AbstractMatrix3D<E> |
vStrides(long sliceStride,
long rowStride,
long columnStride)
Self-modifying version of
viewStrides(long, long, long) . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getQuick, viewColumn, viewRow, viewSlice
protected long slices
protected long rows
protected long columns
protected long sliceZero
protected long rowZero
protected long columnZero
protected long sliceStride
protected long rowStride
protected long columnStride
protected boolean isView
protected AbstractMatrix3D()
protected AbstractMatrix3D(long slices, long rows, long columns)
slices
- slices, must be >= 0
rows
- rows, must be >= 0
columns
- columns, must be >= 0
IllegalArgumentException
- if any of slices
,
rows
, or columns
are negativeprotected AbstractMatrix3D(long slices, long rows, long columns, long sliceZero, long rowZero, long columnZero, long sliceStride, long rowStride, long columnStride, boolean isView)
slices
- slices, must be >= 0
rows
- rows, must be >= 0
columns
- columns, must be >= 0
sliceZero
- slice of the first elementrowZero
- row of the first elementcolumnZero
- column of the first elementsliceStride
- number of slices between two elementsrowStride
- number of rows between two elementscolumnStride
- number of columns between two elementsisView
- true if this instance is a viewpublic long size()
public long slices()
public long rows()
public long columns()
public long cardinality()
cardinality
in interface Matrix3D<E>
public boolean isEmpty()
public void clear()
public Iterator<E> iterator()
null
s.public E get(long slice, long row, long column)
public void set(long slice, long row, long column, E e)
e
(optional operation).public void setQuick(long slice, long row, long column, E e)
e
without checking bounds (optional operation).public Matrix3D<E> assign(E e)
e
(optional
operation).public Matrix3D<E> assign(UnaryFunction<E,E> function)
public Matrix3D<E> assign(Matrix3D<? extends E> other)
public Matrix3D<E> assign(Matrix3D<? extends E> other, BinaryFunction<E,E,E> function)
public E aggregate(BinaryFunction<E,E,E> aggr, UnaryFunction<E,E> function)
public E aggregate(Matrix3D<? extends E> other, BinaryFunction<E,E,E> aggr, BinaryFunction<E,E,E> function)
protected AbstractMatrix3D<E> view()
protected AbstractMatrix3D<E> vDice(int axis0, int axis1, int axis2)
viewDice(int, int, int)
.axis0
- first axisaxis1
- second axisaxis2
- third axisthis
public Matrix3D<E> viewDice(int axis0, int axis1, int axis2)
viewDice
in interface Matrix3D<E>
axis0
- the axis that shall become axis 0 (0 for slice, 1 for row, 2 for column)axis1
- the axis that shall become axis 0 (0 for slice, 1 for row, 2 for column)axis2
- the axis that shall become axis 0 (0 for slice, 1 for row, 2 for column)protected AbstractMatrix3D<E> vSliceFlip()
viewSliceFlip()
.this
public Matrix3D<E> viewSliceFlip()
0
is now slice slices() - 1
,
..., what used to be slice slices() - 1
is now slice 0
.
The view is backed by this matrix, so changes made to the returned
view are reflected in this matrix, and vice-versa.viewSliceFlip
in interface Matrix3D<E>
protected AbstractMatrix3D<E> vRowFlip()
viewRowFlip()
.this
public Matrix3D<E> viewRowFlip()
0
is now row rows() - 1
,
..., what used to be row rows() - 1
is now row 0
.
The view is backed by this matrix, so changes made to the returned
view are reflected in this matrix, and vice-versa.viewRowFlip
in interface Matrix3D<E>
protected AbstractMatrix3D<E> vColumnFlip()
viewColumnFlip()
.this
public Matrix3D<E> viewColumnFlip()
0
is now column columns() - 1
,
..., what used to be column columns() - 1
is now column
0
. The view is backed by this matrix, so changes made to the
returned view are reflected in this matrix, and vice-versa.viewColumnFlip
in interface Matrix3D<E>
protected AbstractMatrix3D<E> vPart(long slice, long row, long column, long depth, long height, long width)
viewPart(long, long, long, long, long, long)
.slice
- slicerow
- rowcolumn
- columndepth
- depthheight
- heightwidth
- widththis
public Matrix3D<E> viewPart(long slice, long row, long column, long depth, long height, long width)
(slice, row, column)
to
(slice + depth - 1, row + height - 1, column + width - 1)
.
The view is backed by this matrix, so changes made to the returned
view are reflected in this matrix, and vice-versa.viewPart
in interface Matrix3D<E>
slice
- slice index, must be >= 0
and < slices()
row
- row index, must be >= 0
and < rows()
column
- column index, must be >= 0
and < columns()
depth
- depthheight
- heightwidth
- width(slice, row, column)
to
(slice + depth - 1, row + height - 1, column + width - 1)
.public Matrix3D<E> viewSelection(long[] sliceIndices, long[] rowIndices, long[] columnIndices)
viewSelection
in interface Matrix3D<E>
sliceIndices
- slice indicesrowIndices
- row indicescolumnIndices
- column indicespublic Matrix3D<E> viewSelection(UnaryPredicate<Matrix2D<E>> predicate)
viewSelection
in interface Matrix3D<E>
predicate
- predicate, must not be nullpublic Matrix3D<E> viewSelection(BitMatrix3D mask)
viewSelection
in interface Matrix3D<E>
mask
- 3D bit mask, must not be nullprotected AbstractMatrix3D<E> vStrides(long sliceStride, long rowStride, long columnStride)
viewStrides(long, long, long)
.sliceStride
- slice striderowStride
- row stridecolumnStride
- column stridethis
public Matrix3D<E> viewStrides(long sliceStride, long rowStride, long columnStride)
sliceStride
-th slice, every rowStride
-th
row, and every columnStride
-th column. The view is backed by
this matrix, so changes made to the returned view are reflected in this
matrix, and vice-versa.viewStrides
in interface Matrix3D<E>
sliceStride
- slice stride, must be > 0
rowStride
- row stride, must be > 0
columnStride
- column stride, must be > 0
sliceStride
-th slice, every rowStride
-th
row, and every columnStride
-th column.public void forEach(UnaryProcedure<? super E> procedure)
For example:
Matrix3D<String> m; m.forEach(new UnaryProcedure<String>() { public void run(final String value) { System.out.println(value); } });
public void forEach(UnaryPredicate<? super E> predicate, UnaryProcedure<? super E> procedure)
For example:
Matrix3D<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); } });
public void forEachNonNull(UnaryProcedure<? super E> procedure)
For example:
Matrix3D<String> m; m.forEachNonNull(new UnaryProcedure<String>() { public void run(final String value) { System.out.println(value); } });
forEachNonNull
in interface Matrix3D<E>
procedure
- procedure, must not be nullpublic void forEach(QuaternaryProcedure<Long,Long,Long,? super E> procedure)
For example:
Matrix3D<String> m; m.forEach(new QuaternaryProcedure<Long, Long, Long, String>() { public void run(final Long slice, final Long row, final Long column, final String value) { System.out.print("m[" + slice + ", " + row + ", " + column + "]=" + value); } });
public void forEach(QuaternaryPredicate<Long,Long,Long,? super E> predicate, QuaternaryProcedure<Long,Long,Long,? super E> procedure)
For example:
Matrix3D<String> m; m.forEach(new QuaternaryPredicate<Long, Long, Long, String>() { public boolean test(final Long slice, final Long row, final Long column, final String value) { return (value != null); } }, new QuaternaryProcedure<Long, Long, Long, String>() { public void run(final Long slice, final Long row, final Long column, final String value) { System.out.print("m[" + slice + ", " + row + ", " + column + "]=" + value); } });
protected long sliceZero()
protected long rowZero()
protected long columnZero()
protected long sliceStride()
protected long rowStride()
protected long columnStride()
protected boolean isView()
Copyright (c) 2004-2013 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).