Ejemplo n.º 1
0
        /*
         * ========================================
         *              Modify Menu
         * ========================================
         */
        /**
         * Modify menu loop
         */
        private void loopMenuModify()
        {
            int  selItem;
            Menu menu = new Menu(MenuData.MODIFY_TITLE, MenuData.MODIFY_CONTENT, this);

            do
            {
                selItem = menu.getItem();
                switch (selItem)
                {
                case MenuData.MODIFY_SET_CELL:
                    trackPuzzleUndo();
                    setCell();
                    break;

                case MenuData.MODIFY_ROTATE_CLOCK_WISE:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.rotateClockWise(puzzle);
                    break;

                case MenuData.MODIFY_ROTATE_COUNTER_CLOCK_WISE:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.rotateCounterclockWise(puzzle);
                    break;

                case MenuData.MODIFY_TRANSPOSE_TL_BR:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.transposeTlBr(puzzle);
                    break;

                case MenuData.MODIFY_TRANSPOSE_TR_BL:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.transposeTrBl(puzzle);
                    break;

                case MenuData.MODIFY_REFLECT_HORIZ:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.reflectHorizontally(puzzle);
                    break;

                case MenuData.MODIFY_REFLECT_VERT:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.reflectVertically(puzzle);
                    break;

                case MenuData.MODIFY_SWAP_COL_SEGMENTS:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.swapColSegmentsRandomly(puzzle);
                    break;

                case MenuData.MODIFY_SWAP_ROW_SEGMENTS:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.swapRowSegmentsRandomly(puzzle);
                    break;

                case MenuData.MODIFY_SWAP_COLS_IN_SEGMENTS:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.swapColsInSegmentRandomly(puzzle);
                    break;

                case MenuData.MODIFY_SWAP_ROWS_IN_SEGMENTS:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.swapRowsInSegmentRandomly(puzzle);
                    break;

                case MenuData.MODIFY_PERMUTE:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.permuteBoard(puzzle);
                    break;

                case MenuData.MODIFY_RANDOM_TRANSF_ONE:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.randomBoardTransf(puzzle);
                    break;

                case MenuData.MODIFY_RANDOM_TRANSF_SEQ:
                    trackPuzzleUndo();
                    puzzle = SudokuStore.seqOfRandomBoardTransf(puzzle);
                    break;

                case MenuData.UNDO:
                    performPuzzleUndo();
                    break;

                case MenuData.REDO:
                    performPuzzleRedo();
                    break;

                default: incorrectSelection(); break;
                }
            } while (selItem != MenuData.RETURN);
        }