public final class CharMatrix extends AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
cols, count, rows
Constructor and Description |
---|
CharMatrix(char[][] a) |
Modifier and Type | Method and Description |
---|---|
CharMatrix |
add(CharMatrix b) |
Stream<Pair.IntPair> |
adjacent4Points(int i,
int j)
Returns the four adjacencies with order: up, right, down, left.
|
Stream<Pair.IntPair> |
adjacent8Points(int i,
int j)
Returns the eight adjacencies with order: left-up, up, right-up, right, right-down, down, left-down, left.
|
char[][] |
array() |
Matrix<java.lang.Character> |
boxed() |
char[] |
column(int columnIndex) |
CharMatrix |
copy() |
CharMatrix |
copy(int fromRowIndex,
int toRowIndex) |
CharMatrix |
copy(int fromRowIndex,
int toRowIndex,
int fromColumnIndex,
int toColumnIndex) |
static CharMatrix |
diagonal(char[] leftUp2RighDownDiagonal,
char[] rightUp2LeftDownDiagonal) |
static CharMatrix |
diagonalLU2RD(char[] leftUp2RighDownDiagonal) |
static CharMatrix |
diagonalRU2LD(char[] rightUp2LeftDownDiagonal) |
OptionalChar |
downOf(int i,
int j) |
static CharMatrix |
empty() |
boolean |
equals(java.lang.Object obj) |
void |
fill(char val) |
void |
fill(char[][] b) |
void |
fill(int fromRowIndex,
int fromColumnIndex,
char[][] b) |
CharList |
flatten() |
CharMatrix |
flipH() |
CharMatrix |
flipV() |
void |
forEach(CharConsumer action) |
void |
forEach(int fromRowIndex,
int toRowIndex,
int fromColumnIndex,
int toColumnIndex,
CharConsumer action) |
char |
get(int i,
int j) |
char |
get(Pair.IntPair point) |
char[] |
getLU2RD() |
char[] |
getRU2LD() |
int |
hashCode() |
CharMatrix |
hstack(CharMatrix b) |
OptionalChar |
leftOf(int i,
int j) |
CharMatrix |
map(CharUnaryOperator func) |
<T> Matrix<T> |
mapToObj(java.lang.Class<T> cls,
CharFunction<? extends T> func) |
CharMatrix |
multiply(CharMatrix b) |
static CharMatrix |
of(char[]... a) |
static CharMatrix |
random(int len) |
static CharMatrix |
range(char startInclusive,
char endExclusive) |
static CharMatrix |
range(char startInclusive,
char endExclusive,
int by) |
static CharMatrix |
rangeClosed(char startInclusive,
char endInclusive) |
static CharMatrix |
rangeClosed(char startInclusive,
char endInclusive,
int by) |
static CharMatrix |
repeat(char val,
int len) |
CharMatrix |
repelem(int rowRepeats,
int colRepeats)
Repeat elements
rowRepeats times in row direction and colRepeats times in column direction. |
void |
replaceIf(CharPredicate predicate,
char newValue) |
void |
replaceIf(IntBiPredicate predicate,
char newValue)
Replace elements by
Predicate.test(i, j) based on points |
CharMatrix |
repmat(int rowRepeats,
int colRepeats)
Repeat this matrix
rowRepeats times in row direction and colRepeats times in column direction. |
CharMatrix |
reshape(int newRows,
int newCols) |
void |
reverseH() |
void |
reverseV() |
OptionalChar |
rightOf(int i,
int j) |
CharMatrix |
rotate180()
Rotate this matrix clockwise 180
|
CharMatrix |
rotate270()
Rotate this matrix clockwise 270
|
CharMatrix |
rotate90()
Rotate this matrix clockwise 90
|
char[] |
row(int rowIndex) |
void |
set(int i,
int j,
char val) |
void |
set(Pair.IntPair point,
char val) |
void |
setColumn(int columnIndex,
char[] column) |
void |
setLU2RD(char[] diagonal) |
void |
setRow(int rowIndex,
char[] row) |
void |
setRU2LD(char[] diagonal) |
Stream<CharStream> |
streamC() |
Stream<CharStream> |
streamC(int fromColumnIndex,
int toColumnIndex) |
CharStream |
streamH() |
CharStream |
streamH(int rowIndex) |
CharStream |
streamH(int fromRowIndex,
int toRowIndex) |
CharStream |
streamLU2RD() |
Stream<CharStream> |
streamR() |
Stream<CharStream> |
streamR(int fromRowIndex,
int toRowIndex) |
CharStream |
streamRU2LD() |
CharStream |
streamV() |
CharStream |
streamV(int columnIndex) |
CharStream |
streamV(int fromColumnIndex,
int toColumnIndex) |
CharMatrix |
subtract(CharMatrix b) |
DoubleMatrix |
toDoubleMatrix() |
FloatMatrix |
toFloatMatrix() |
IntMatrix |
toIntMatrix() |
LongMatrix |
toLongMatrix() |
java.lang.String |
toString() |
CharMatrix |
transpose() |
void |
updateAll(CharUnaryOperator func) |
void |
updateAll(IntBiFunction<java.lang.Character> func)
Update all elements based on points
|
void |
updateColumn(int columnIndex,
CharUnaryOperator func) |
void |
updateLU2RD(CharUnaryOperator func) |
void |
updateRow(int rowIndex,
CharUnaryOperator func) |
void |
updateRU2LD(CharUnaryOperator func) |
OptionalChar |
upOf(int i,
int j) |
CharMatrix |
vstack(CharMatrix b) |
CharMatrix |
zipWith(CharMatrix matrixB,
CharBiFunction<java.lang.Character> zipFunction) |
CharMatrix |
zipWith(CharMatrix matrixB,
CharMatrix matrixC,
CharTriFunction<java.lang.Character> zipFunction) |
isEmpty, isSameShape, pointsC, pointsC, pointsH, pointsH, pointsH, pointsLU2RD, pointsR, pointsR, pointsRU2LD, pointsV, pointsV, pointsV, println, reshape
public static CharMatrix empty()
@SafeVarargs public static CharMatrix of(char[]... a)
public static CharMatrix random(int len)
public static CharMatrix repeat(char val, int len)
public static CharMatrix range(char startInclusive, char endExclusive)
public static CharMatrix range(char startInclusive, char endExclusive, int by)
public static CharMatrix rangeClosed(char startInclusive, char endInclusive)
public static CharMatrix rangeClosed(char startInclusive, char endInclusive, int by)
public static CharMatrix diagonalLU2RD(char[] leftUp2RighDownDiagonal)
public static CharMatrix diagonalRU2LD(char[] rightUp2LeftDownDiagonal)
public static CharMatrix diagonal(char[] leftUp2RighDownDiagonal, char[] rightUp2LeftDownDiagonal)
public char[][] array()
public char get(int i, int j)
public char get(Pair.IntPair point)
public void set(int i, int j, char val)
public void set(Pair.IntPair point, char val)
public OptionalChar upOf(int i, int j)
public OptionalChar downOf(int i, int j)
public OptionalChar leftOf(int i, int j)
public OptionalChar rightOf(int i, int j)
public Stream<Pair.IntPair> adjacent4Points(int i, int j)
null
is set if the adjacency doesn't exist.i
- j
- public Stream<Pair.IntPair> adjacent8Points(int i, int j)
null
is set if the adjacency doesn't exist.i
- j
- public char[] row(int rowIndex)
public char[] column(int columnIndex)
public void setRow(int rowIndex, char[] row)
public void setColumn(int columnIndex, char[] column)
public void updateRow(int rowIndex, CharUnaryOperator func)
public void updateColumn(int columnIndex, CharUnaryOperator func)
public char[] getLU2RD()
public void setLU2RD(char[] diagonal)
public void updateLU2RD(CharUnaryOperator func)
public char[] getRU2LD()
public void setRU2LD(char[] diagonal)
public void updateRU2LD(CharUnaryOperator func)
public void updateAll(CharUnaryOperator func)
public void updateAll(IntBiFunction<java.lang.Character> func)
func
- public void replaceIf(CharPredicate predicate, char newValue)
public void replaceIf(IntBiPredicate predicate, char newValue)
Predicate.test(i, j)
based on pointspredicate
- newValue
- public CharMatrix map(CharUnaryOperator func)
public <T> Matrix<T> mapToObj(java.lang.Class<T> cls, CharFunction<? extends T> func)
public void fill(char val)
public void fill(char[][] b)
public void fill(int fromRowIndex, int fromColumnIndex, char[][] b)
public CharMatrix copy()
copy
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharMatrix copy(int fromRowIndex, int toRowIndex)
copy
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharMatrix copy(int fromRowIndex, int toRowIndex, int fromColumnIndex, int toColumnIndex)
copy
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public void reverseH()
public void reverseV()
public CharMatrix flipH()
public CharMatrix flipV()
public CharMatrix rotate90()
AbstractMatrix
rotate90
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharMatrix rotate180()
AbstractMatrix
rotate180
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharMatrix rotate270()
AbstractMatrix
rotate270
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharMatrix transpose()
transpose
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharMatrix reshape(int newRows, int newCols)
reshape
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharMatrix repelem(int rowRepeats, int colRepeats)
rowRepeats
times in row direction and colRepeats
times in column direction.repelem
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
rowRepeats
- colRepeats
- public CharMatrix repmat(int rowRepeats, int colRepeats)
rowRepeats
times in row direction and colRepeats
times in column direction.repmat
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
rowRepeats
- colRepeats
- public CharList flatten()
flatten
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharMatrix vstack(CharMatrix b)
b
- IntMatrix.vstack(IntMatrix)
public CharMatrix hstack(CharMatrix b)
b
- IntMatrix.hstack(IntMatrix)
public CharMatrix add(CharMatrix b)
public CharMatrix subtract(CharMatrix b)
public CharMatrix multiply(CharMatrix b)
public Matrix<java.lang.Character> boxed()
public IntMatrix toIntMatrix()
public LongMatrix toLongMatrix()
public FloatMatrix toFloatMatrix()
public DoubleMatrix toDoubleMatrix()
public CharMatrix zipWith(CharMatrix matrixB, CharBiFunction<java.lang.Character> zipFunction)
public CharMatrix zipWith(CharMatrix matrixB, CharMatrix matrixC, CharTriFunction<java.lang.Character> zipFunction)
public CharStream streamLU2RD()
streamLU2RD
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharStream streamRU2LD()
streamRU2LD
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharStream streamH()
streamH
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharStream streamH(int rowIndex)
streamH
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharStream streamH(int fromRowIndex, int toRowIndex)
streamH
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
fromRowIndex
- toRowIndex
- @Beta public CharStream streamV()
streamV
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public CharStream streamV(int columnIndex)
streamV
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
@Beta public CharStream streamV(int fromColumnIndex, int toColumnIndex)
streamV
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
fromColumnIndex
- toColumnIndex
- public Stream<CharStream> streamR()
streamR
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
public Stream<CharStream> streamR(int fromRowIndex, int toRowIndex)
streamR
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
fromRowIndex
- toRowIndex
- @Beta public Stream<CharStream> streamC()
streamC
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
@Beta public Stream<CharStream> streamC(int fromColumnIndex, int toColumnIndex)
streamC
in class AbstractMatrix<char[],CharList,CharStream,Stream<CharStream>,CharMatrix>
fromColumnIndex
- toColumnIndex
- public void forEach(CharConsumer action)
public void forEach(int fromRowIndex, int toRowIndex, int fromColumnIndex, int toColumnIndex, CharConsumer action)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object