diagram-system / DIAGRAM SYSTEM / src / system / Flag.java
Flag.java
Raw
package system;

import app.DrawingApp;
import gui.BoardCell;

public class Flag extends java.lang.Object implements Diagram {

	char[][] board = {};
	int animationType = 0;

	// CONSTRUCTOR

	public Flag(int size, char color1, char color2, char color3,
			int animationType) {

		this.board = BoardCell
				.getCharArray(DrawingApp.getFlag(size,color1,color2,color3));
		this.animationType = animationType;

	}

	// METHODS

	public char[][] getBoard() {
		return board;
	}

	public char[][] nextAnimationStep() {

		if (animationType == 1) {
			TwoDimArrayUtil.rotateLeftOneColumn(board);
		}

		if (animationType == 2) {
			TwoDimArrayUtil.rotateTopOneRow(board);
		}

		return board;
	}

	public int getNumberRows() {

		return board.length;

	}

	public int getNumberCols() {

		return board[0].length;

	}
}