isColumn/RowOnlyFalse
This commit is contained in:
parent
e7c7065a8d
commit
8ec5a622d8
@ -36,4 +36,22 @@ public class Array{
|
||||
}
|
||||
return newMatrix;
|
||||
}
|
||||
|
||||
public static boolean isRowOnlyFalse(boolean[][] o, int row){
|
||||
boolean mark = true;
|
||||
for (int i = 0; i < o[row].length; i++) {
|
||||
if(o[row][i])
|
||||
mark = false;
|
||||
}
|
||||
return mark;
|
||||
}
|
||||
|
||||
public static boolean isColumnOnlyFalse(boolean[][] o, int column){
|
||||
boolean mark = true;
|
||||
for (int i = 0; i < o.length; i++) {
|
||||
if(o[i][column])
|
||||
mark = false;
|
||||
}
|
||||
return mark;
|
||||
}
|
||||
}
|
||||
|
@ -56,4 +56,26 @@ class ArrayTest {
|
||||
boolean[][] result = Array.MatrixRemoveColumn(a, 1);
|
||||
assertArrayEquals(b, result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void isRowOnlyFalse() {
|
||||
boolean[][] a = new boolean[][] {
|
||||
{true, false, true},
|
||||
{false, false, false},
|
||||
{true, false, true},
|
||||
};
|
||||
assertTrue(Array.isRowOnlyFalse(a, 1));
|
||||
assertFalse(Array.isRowOnlyFalse(a, 0));
|
||||
}
|
||||
|
||||
@Test
|
||||
void isColumnOnlyFalse() {
|
||||
boolean[][] a = new boolean[][] {
|
||||
{true, false, true},
|
||||
{false, false, false},
|
||||
{true, false, true},
|
||||
};
|
||||
assertTrue(Array.isColumnOnlyFalse(a, 1));
|
||||
assertFalse(Array.isColumnOnlyFalse(a, 0));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user