public final class BooleanMatrix extends AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
cols, count, rows
Constructor and Description |
---|
BooleanMatrix(boolean[][] a) |
Modifier and Type | Method and Description |
---|---|
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.
|
boolean[][] |
array() |
Matrix<java.lang.Boolean> |
boxed() |
boolean[] |
column(int columnIndex) |
BooleanMatrix |
copy() |
BooleanMatrix |
copy(int fromRowIndex,
int toRowIndex) |
BooleanMatrix |
copy(int fromRowIndex,
int toRowIndex,
int fromColumnIndex,
int toColumnIndex) |
static BooleanMatrix |
diagonal(boolean[] leftUp2RighDownDiagonal,
boolean[] rightUp2LeftDownDiagonal) |
static BooleanMatrix |
diagonalLU2RD(boolean[] leftUp2RighDownDiagonal) |
static BooleanMatrix |
diagonalRU2LD(boolean[] rightUp2LeftDownDiagonal) |
OptionalBoolean |
downOf(int i,
int j) |
static BooleanMatrix |
empty() |
boolean |
equals(java.lang.Object obj) |
void |
fill(boolean val) |
void |
fill(boolean[][] b) |
void |
fill(int fromRowIndex,
int fromColumnIndex,
boolean[][] b) |
BooleanList |
flatten() |
BooleanMatrix |
flipH() |
BooleanMatrix |
flipV() |
void |
forEach(BooleanConsumer action) |
void |
forEach(int fromRowIndex,
int toRowIndex,
int fromColumnIndex,
int toColumnIndex,
BooleanConsumer action) |
boolean |
get(int i,
int j) |
boolean |
get(Pair.IntPair point) |
boolean[] |
getLU2RD() |
boolean[] |
getRU2LD() |
int |
hashCode() |
BooleanMatrix |
hstack(BooleanMatrix b) |
OptionalBoolean |
leftOf(int i,
int j) |
BooleanMatrix |
map(BooleanUnaryOperator func) |
<T> Matrix<T> |
mapToObj(java.lang.Class<T> cls,
BooleanFunction<? extends T> func) |
static BooleanMatrix |
of(boolean[]... a) |
static BooleanMatrix |
random(int len) |
static BooleanMatrix |
repeat(boolean val,
int len) |
BooleanMatrix |
repelem(int rowRepeats,
int colRepeats)
Repeat elements
rowRepeats times in row direction and colRepeats times in column direction. |
void |
replaceIf(BooleanPredicate predicate,
boolean newValue) |
void |
replaceIf(IntBiPredicate predicate,
boolean newValue)
Replace elements by
Predicate.test(i, j) based on points |
BooleanMatrix |
repmat(int rowRepeats,
int colRepeats)
Repeat this matrix
rowRepeats times in row direction and colRepeats times in column direction. |
BooleanMatrix |
reshape(int newRows,
int newCols) |
void |
reverseH() |
void |
reverseV() |
OptionalBoolean |
rightOf(int i,
int j) |
BooleanMatrix |
rotate180()
Rotate this matrix clockwise 180
|
BooleanMatrix |
rotate270()
Rotate this matrix clockwise 270
|
BooleanMatrix |
rotate90()
Rotate this matrix clockwise 90
|
boolean[] |
row(int rowIndex) |
void |
set(int i,
int j,
boolean val) |
void |
set(Pair.IntPair point,
boolean val) |
void |
setColumn(int columnIndex,
boolean[] column) |
void |
setLU2RD(boolean[] diagonal) |
void |
setRow(int rowIndex,
boolean[] row) |
void |
setRU2LD(boolean[] diagonal) |
Stream<Stream<java.lang.Boolean>> |
streamC() |
Stream<Stream<java.lang.Boolean>> |
streamC(int fromColumnIndex,
int toColumnIndex) |
Stream<java.lang.Boolean> |
streamH() |
Stream<java.lang.Boolean> |
streamH(int rowIndex) |
Stream<java.lang.Boolean> |
streamH(int fromRowIndex,
int toRowIndex) |
Stream<java.lang.Boolean> |
streamLU2RD() |
Stream<Stream<java.lang.Boolean>> |
streamR() |
Stream<Stream<java.lang.Boolean>> |
streamR(int fromRowIndex,
int toRowIndex) |
Stream<java.lang.Boolean> |
streamRU2LD() |
Stream<java.lang.Boolean> |
streamV() |
Stream<java.lang.Boolean> |
streamV(int columnIndex) |
Stream<java.lang.Boolean> |
streamV(int fromColumnIndex,
int toColumnIndex) |
java.lang.String |
toString() |
BooleanMatrix |
transpose() |
void |
updateAll(BooleanUnaryOperator func) |
void |
updateAll(IntBiFunction<java.lang.Boolean> func)
Update all elements based on points
|
void |
updateColumn(int columnIndex,
BooleanUnaryOperator func) |
void |
updateLU2RD(BooleanUnaryOperator func) |
void |
updateRow(int rowIndex,
BooleanUnaryOperator func) |
void |
updateRU2LD(BooleanUnaryOperator func) |
OptionalBoolean |
upOf(int i,
int j) |
BooleanMatrix |
vstack(BooleanMatrix b) |
BooleanMatrix |
zipWith(BooleanMatrix matrixB,
BooleanBiFunction<java.lang.Boolean> zipFunction) |
BooleanMatrix |
zipWith(BooleanMatrix matrixB,
BooleanMatrix matrixC,
BooleanTriFunction<java.lang.Boolean> zipFunction) |
isEmpty, isSameShape, pointsC, pointsC, pointsH, pointsH, pointsH, pointsLU2RD, pointsR, pointsR, pointsRU2LD, pointsV, pointsV, pointsV, println, reshape
public static BooleanMatrix empty()
@SafeVarargs public static BooleanMatrix of(boolean[]... a)
public static BooleanMatrix random(int len)
public static BooleanMatrix repeat(boolean val, int len)
public static BooleanMatrix diagonalLU2RD(boolean[] leftUp2RighDownDiagonal)
public static BooleanMatrix diagonalRU2LD(boolean[] rightUp2LeftDownDiagonal)
public static BooleanMatrix diagonal(boolean[] leftUp2RighDownDiagonal, boolean[] rightUp2LeftDownDiagonal)
public boolean[][] array()
public boolean get(int i, int j)
public boolean get(Pair.IntPair point)
public void set(int i, int j, boolean val)
public void set(Pair.IntPair point, boolean val)
public OptionalBoolean upOf(int i, int j)
public OptionalBoolean downOf(int i, int j)
public OptionalBoolean leftOf(int i, int j)
public OptionalBoolean 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 boolean[] row(int rowIndex)
public boolean[] column(int columnIndex)
public void setRow(int rowIndex, boolean[] row)
public void setColumn(int columnIndex, boolean[] column)
public void updateRow(int rowIndex, BooleanUnaryOperator func)
public void updateColumn(int columnIndex, BooleanUnaryOperator func)
public boolean[] getLU2RD()
public void setLU2RD(boolean[] diagonal)
public void updateLU2RD(BooleanUnaryOperator func)
public boolean[] getRU2LD()
public void setRU2LD(boolean[] diagonal)
public void updateRU2LD(BooleanUnaryOperator func)
public void updateAll(BooleanUnaryOperator func)
public void updateAll(IntBiFunction<java.lang.Boolean> func)
func
- public void replaceIf(BooleanPredicate predicate, boolean newValue)
public void replaceIf(IntBiPredicate predicate, boolean newValue)
Predicate.test(i, j)
based on pointspredicate
- newValue
- public BooleanMatrix map(BooleanUnaryOperator func)
public <T> Matrix<T> mapToObj(java.lang.Class<T> cls, BooleanFunction<? extends T> func)
public void fill(boolean val)
public void fill(boolean[][] b)
public void fill(int fromRowIndex, int fromColumnIndex, boolean[][] b)
public BooleanMatrix copy()
copy
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public BooleanMatrix copy(int fromRowIndex, int toRowIndex)
copy
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public BooleanMatrix copy(int fromRowIndex, int toRowIndex, int fromColumnIndex, int toColumnIndex)
copy
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public void reverseH()
public void reverseV()
public BooleanMatrix flipH()
public BooleanMatrix flipV()
public BooleanMatrix rotate90()
AbstractMatrix
rotate90
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public BooleanMatrix rotate180()
AbstractMatrix
rotate180
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public BooleanMatrix rotate270()
AbstractMatrix
rotate270
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public BooleanMatrix transpose()
transpose
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public BooleanMatrix reshape(int newRows, int newCols)
reshape
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public BooleanMatrix repelem(int rowRepeats, int colRepeats)
rowRepeats
times in row direction and colRepeats
times in column direction.repelem
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
rowRepeats
- colRepeats
- public BooleanMatrix repmat(int rowRepeats, int colRepeats)
rowRepeats
times in row direction and colRepeats
times in column direction.repmat
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
rowRepeats
- colRepeats
- public BooleanList flatten()
flatten
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public BooleanMatrix vstack(BooleanMatrix b)
b
- IntMatrix.vstack(IntMatrix)
public BooleanMatrix hstack(BooleanMatrix b)
b
- IntMatrix.hstack(IntMatrix)
public Matrix<java.lang.Boolean> boxed()
public BooleanMatrix zipWith(BooleanMatrix matrixB, BooleanBiFunction<java.lang.Boolean> zipFunction)
public BooleanMatrix zipWith(BooleanMatrix matrixB, BooleanMatrix matrixC, BooleanTriFunction<java.lang.Boolean> zipFunction)
public Stream<java.lang.Boolean> streamLU2RD()
streamLU2RD
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public Stream<java.lang.Boolean> streamRU2LD()
streamRU2LD
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public Stream<java.lang.Boolean> streamH()
streamH
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public Stream<java.lang.Boolean> streamH(int rowIndex)
streamH
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public Stream<java.lang.Boolean> streamH(int fromRowIndex, int toRowIndex)
streamH
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
fromRowIndex
- toRowIndex
- @Beta public Stream<java.lang.Boolean> streamV()
streamV
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public Stream<java.lang.Boolean> streamV(int columnIndex)
streamV
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
@Beta public Stream<java.lang.Boolean> streamV(int fromColumnIndex, int toColumnIndex)
streamV
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
fromColumnIndex
- toColumnIndex
- public Stream<Stream<java.lang.Boolean>> streamR()
streamR
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
public Stream<Stream<java.lang.Boolean>> streamR(int fromRowIndex, int toRowIndex)
streamR
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
fromRowIndex
- toRowIndex
- @Beta public Stream<Stream<java.lang.Boolean>> streamC()
streamC
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
@Beta public Stream<Stream<java.lang.Boolean>> streamC(int fromColumnIndex, int toColumnIndex)
streamC
in class AbstractMatrix<boolean[],BooleanList,Stream<java.lang.Boolean>,Stream<Stream<java.lang.Boolean>>,BooleanMatrix>
fromColumnIndex
- toColumnIndex
- public void forEach(BooleanConsumer action)
public void forEach(int fromRowIndex, int toRowIndex, int fromColumnIndex, int toColumnIndex, BooleanConsumer 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