@Test public void testFindLeastFreeCellWithAlmostFull() { byte[][] data = QuadraticArrays.parse( "067915482", "149268357", "582473619", "436187925", "975624831", "218359764", "624731598", "753892146", "891546273" ); GameMatrixImpl matrix = new GameMatrixImpl(); matrix.setAll(data); int[] min = new int[2]; boolean found = matrix.findLeastFreeCell(min); assertTrue(found); assertEquals(0, min[0]); assertEquals(0, min[1]); }
@Override public final void setAll(final byte[][] initializationData) { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { set(j, i, initializationData[j][i]); } } }
GameMatrixImpl implements Cloneable, BitFreeMatrixInterface { @Override public final void setAll(final byte[][] initializationData) { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { set(j, i, initializationData[j][i]); } } } }
GameMatrixImpl implements Cloneable, BitFreeMatrixInterface { @Override public final void setAll(final byte[][] initializationData) { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { set(j, i, initializationData[j][i]); } } } GameMatrixImpl(); }
GameMatrixImpl implements Cloneable, BitFreeMatrixInterface { @Override public final void setAll(final byte[][] initializationData) { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { set(j, i, initializationData[j][i]); } } } GameMatrixImpl(); @Override final void setAll(final byte[][] initializationData); @Override final void clear(); @Override final byte get(final int row, final int column); @Override void set(final int row, final int column, final byte value); @Override int getSetCount(); @Override final byte[][] getArray(); @Override final String toString(); @Override int hashCode(); @Override final boolean equals(final Object obj); @Override Object clone(); @Override final boolean isValid(); @Override int getFreeMask(
            final int row,
            final int column); @Override final boolean canSet(
            final int row,
            final int column,
            final byte value); }
GameMatrixImpl implements Cloneable, BitFreeMatrixInterface { @Override public final void setAll(final byte[][] initializationData) { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { set(j, i, initializationData[j][i]); } } } GameMatrixImpl(); @Override final void setAll(final byte[][] initializationData); @Override final void clear(); @Override final byte get(final int row, final int column); @Override void set(final int row, final int column, final byte value); @Override int getSetCount(); @Override final byte[][] getArray(); @Override final String toString(); @Override int hashCode(); @Override final boolean equals(final Object obj); @Override Object clone(); @Override final boolean isValid(); @Override int getFreeMask(
            final int row,
            final int column); @Override final boolean canSet(
            final int row,
            final int column,
            final byte value);  }