package system; public class CombineTopBottom extends java.lang.Object implements Diagram { char[][] board = {}; int animationType = 0; // CONSTRUCTOR public CombineTopBottom(Diagram top, Diagram bottom, int animationType) { if (bottom.getNumberCols() != top.getNumberCols()) { throw new IllegalArgumentException( "Error: number of columns are different"); } this.animationType = animationType; this.board = TwoDimArrayUtil.appendTopBottom(top.getBoard(), bottom.getBoard()); } // METHODS public char[][] getBoard() { return board; } public int getNumberRows() { return board.length; } public int getNumberCols() { return board[0].length; } public char[][] nextAnimationStep() { if (animationType == 1) { TwoDimArrayUtil.rotateLeftOneColumn(board); } else if (animationType == 2) { TwoDimArrayUtil.rotateTopOneRow(board); } return board; } }