@Test public void testClone() { byte[][] data = QuadraticArrays.parse(FULL_EXAMPLE); CachedGameMatrixImpl matrix = new CachedGameMatrixImpl(); matrix.setAll(data); CachedGameMatrixImpl clone = (CachedGameMatrixImpl) matrix.clone(); String out = clone.toString(); String expected = Arrays.stream(FULL_EXAMPLE) .collect(Collectors.joining("\n"))+"\n"; assertEquals(expected, out); }
@Override public Object clone() { CachedGameMatrixImpl clone; clone = (CachedGameMatrixImpl) super.clone(); clone.blockFree = QuadraticArrays.cloneArray(blockFree); clone.columnFree = Arrays.copyOf(columnFree, columnFree.length); clone.rowFree = Arrays.copyOf(rowFree, rowFree.length); return clone; }
CachedGameMatrixImpl extends GameMatrixImpl implements Cloneable { @Override public Object clone() { CachedGameMatrixImpl clone; clone = (CachedGameMatrixImpl) super.clone(); clone.blockFree = QuadraticArrays.cloneArray(blockFree); clone.columnFree = Arrays.copyOf(columnFree, columnFree.length); clone.rowFree = Arrays.copyOf(rowFree, rowFree.length); return clone; } }
CachedGameMatrixImpl extends GameMatrixImpl implements Cloneable { @Override public Object clone() { CachedGameMatrixImpl clone; clone = (CachedGameMatrixImpl) super.clone(); clone.blockFree = QuadraticArrays.cloneArray(blockFree); clone.columnFree = Arrays.copyOf(columnFree, columnFree.length); clone.rowFree = Arrays.copyOf(rowFree, rowFree.length); return clone; } CachedGameMatrixImpl(); }
CachedGameMatrixImpl extends GameMatrixImpl implements Cloneable { @Override public Object clone() { CachedGameMatrixImpl clone; clone = (CachedGameMatrixImpl) super.clone(); clone.blockFree = QuadraticArrays.cloneArray(blockFree); clone.columnFree = Arrays.copyOf(columnFree, columnFree.length); clone.rowFree = Arrays.copyOf(rowFree, rowFree.length); return clone; } CachedGameMatrixImpl(); @Override int getFreeMask(final int row, final int column); @Override void set(final int row, final int column, final byte value); @Override int getSetCount(); @Override Object clone(); }
CachedGameMatrixImpl extends GameMatrixImpl implements Cloneable { @Override public Object clone() { CachedGameMatrixImpl clone; clone = (CachedGameMatrixImpl) super.clone(); clone.blockFree = QuadraticArrays.cloneArray(blockFree); clone.columnFree = Arrays.copyOf(columnFree, columnFree.length); clone.rowFree = Arrays.copyOf(rowFree, rowFree.length); return clone; } CachedGameMatrixImpl(); @Override int getFreeMask(final int row, final int column); @Override void set(final int row, final int column, final byte value); @Override int getSetCount(); @Override Object clone();  }