diff --git a/src/com/patryk/mathdoku/BoardPosVecProperty.java b/src/com/patryk/mathdoku/BoardPosVecProperty.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/GameContext.java b/src/com/patryk/mathdoku/GameContext.java deleted file mode 100644 index dc858ca46e35f6f0ef08448e3e6089df607dc20b..0000000000000000000000000000000000000000 --- a/src/com/patryk/mathdoku/GameContext.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.patryk.mathdoku; - -import com.patryk.mathdoku.actions.*; -import com.patryk.mathdoku.cageData.CageData; -import com.patryk.mathdoku.cageData.DataFormatException; -import com.patryk.mathdoku.errorChecking.UserErrorChecker; -import com.patryk.mathdoku.util.BoardPosVec; - -/** - * Represents one status of the playing of the game e.g. the cage data, what the user has entered - */ -public class GameContext { - - private int boardWidth; - - private CageData cageData; - private UserData userData; - private UserErrorChecker userErrorChecker; - - StackActionRecorder<Action> actionRecorder; - - public StackActionRecorder<Action> getActionRecorder() { - return actionRecorder; - } - - - UserData.ChangeListener updateErrorState = (UserData.ChangeListener.ChangeData changeData) -> { - userErrorChecker.onGridChange(changeData); - }; - - - public GameContext(String data) throws DataFormatException { - cageData = new CageData(data); - this.boardWidth = cageData.getWidth(); - BoardPosVec.setBoardWidth(boardWidth); - Action.setGameContext(this); - userData = new UserData(boardWidth); - actionRecorder = new StackActionRecorder<>(5); - //userData.fill(); - - userErrorChecker = new UserErrorChecker(boardWidth, userData, cageData); - - userData.addChangeListener(updateErrorState); - - } - - - - - public CageData getCageData() { - return cageData; - } - - public UserData getUserData() { - return userData; - } - - - public void setValueAtCell(BoardPosVec cell, int value, boolean record ) { - int oldValue = userData.getValueAtCell(cell); - userData.setValueAtCell(cell, value); - - if (record) - actionRecorder.record(new CellValueChangeAction(cell, oldValue, value)); - } - - public void clear(boolean record) { - UserData copy = UserData.move(userData); - - if(record) { - actionRecorder.record(new ClearAction(copy)); - } - - } - - public int getBoardWidth() { - return boardWidth; - } - - public void undo() { - actionRecorder.undo().undo(); - } - - public void redo() { - actionRecorder.redo().redo(); - UndoRedoButtonManager.me().onRedoButtonPressed(); - } - - - public UserErrorChecker getErrorChecker() { - return userErrorChecker; - } - - - public boolean isWon() { - if (userData.isFull()) { - if (userErrorChecker.noErrors()) { - return true; - } - } - - return false; - } -} \ No newline at end of file diff --git a/src/com/patryk/mathdoku/MathDoku.java b/src/com/patryk/mathdoku/MathDoku.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/UserData.java b/src/com/patryk/mathdoku/UserData.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/actions/Action.java b/src/com/patryk/mathdoku/actions/Action.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/actions/ActionRecorder.java b/src/com/patryk/mathdoku/actions/ActionRecorder.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/actions/CellValueChangeAction.java b/src/com/patryk/mathdoku/actions/CellValueChangeAction.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/actions/ClearAction.java b/src/com/patryk/mathdoku/actions/ClearAction.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/actions/LimitedStack.java b/src/com/patryk/mathdoku/actions/LimitedStack.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/actions/LimitedStackBase.java b/src/com/patryk/mathdoku/actions/LimitedStackBase.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/actions/StackActionRecorder.java b/src/com/patryk/mathdoku/actions/StackActionRecorder.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/actions/UndoRedoButtonManager.java b/src/com/patryk/mathdoku/actions/UndoRedoButtonManager.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/cageData/Cage.java b/src/com/patryk/mathdoku/cageData/Cage.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/cageData/CageData.java b/src/com/patryk/mathdoku/cageData/CageData.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/cageData/CageParser.java b/src/com/patryk/mathdoku/cageData/CageParser.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/errorChecking/BoardData.java b/src/com/patryk/mathdoku/errorChecking/BoardData.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/errorChecking/CageChecker.java b/src/com/patryk/mathdoku/errorChecking/CageChecker.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/errorChecking/CageInfo.java b/src/com/patryk/mathdoku/errorChecking/CageInfo.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/errorChecking/ErrorShower.java b/src/com/patryk/mathdoku/errorChecking/ErrorShower.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/errorChecking/NewGameDialog.java b/src/com/patryk/mathdoku/errorChecking/NewGameDialog.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/errorChecking/RCChecker.java b/src/com/patryk/mathdoku/errorChecking/RCChecker.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/errorChecking/RecursiveSolver.java b/src/com/patryk/mathdoku/errorChecking/RecursiveSolver.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/errorChecking/UserErrorChecker.java b/src/com/patryk/mathdoku/errorChecking/UserErrorChecker.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/gui/GameGridView.java b/src/com/patryk/mathdoku/gui/GameGridView.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/gui/GameUI.java b/src/com/patryk/mathdoku/gui/GameUI.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/gui/InputHandler.java b/src/com/patryk/mathdoku/gui/InputHandler.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/gui/ManualGameInputDialog.java b/src/com/patryk/mathdoku/gui/ManualGameInputDialog.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/gui/drawers/CageDrawer.java b/src/com/patryk/mathdoku/gui/drawers/CageDrawer.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/gui/drawers/Drawer.java b/src/com/patryk/mathdoku/gui/drawers/Drawer.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/gui/drawers/ErrorsHighlighter.java b/src/com/patryk/mathdoku/gui/drawers/ErrorsHighlighter.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/gui/drawers/SelectedCellDrawer.java b/src/com/patryk/mathdoku/gui/drawers/SelectedCellDrawer.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/gui/drawers/UserDataDrawer.java b/src/com/patryk/mathdoku/gui/drawers/UserDataDrawer.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/util/BoardPosVec.java b/src/com/patryk/mathdoku/util/BoardPosVec.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/util/MatcherHelper.java b/src/com/patryk/mathdoku/util/MatcherHelper.java old mode 100644 new mode 100755 diff --git a/src/com/patryk/mathdoku/util/Util.java b/src/com/patryk/mathdoku/util/Util.java old mode 100644 new mode 100755