System.out.println();\r
if (i % 27 == 0)\r
System.out.println();\r
- System.out.print("" + (tab[i] == 0 ? "-" : tab[i]));\r
+ System.out.print("" + (tab[i] == 0 ? "-" : Integer.valueOf(tab[i])));\r
}\r
System.out.println();\r
}\r
// mr1:\r
if (gotoMR1) {\r
gotoMR1 = false;\r
- i1 = (int) (MWC() >> 8) & 127;\r
+ i1 = (MWC() >> 8) & 127;\r
if (i1 > 80) {\r
gotoMR1 = true;\r
continue; // these 2 instructions stand for: goto mr1;\r
// mr3:\r
if (gotoMR3) {\r
gotoMR3 = false;\r
- s = (int) (MWC() >> 9) & 15;\r
+ s = (MWC() >> 9) & 15;\r
if (s > 8) {\r
gotoMR3 = true;\r
continue; // these 2 instructions stand for: goto mr3;\r
x = i;\r
while (x >= i) {\r
// mr4:\r
- x = (int) (MWC() >> 8) & 127;\r
+ x = (MWC() >> 8) & 127;\r
}\r
x++;\r
P[i] = P[x];\r
w++;\r
W[w] = c;\r
}\r
- ;\r
+ \r
if (V[c] < min) {\r
w = 1;\r
W[w] = c;\r
if (gotoMR) {\r
gotoMR = false;\r
\r
- c2 = (int) (MWC() & Two[w]);\r
+ c2 = (MWC() & Two[w]);\r
if (c2 >= w) {\r
gotoMR = true;\r
continue; // simulates: goto mr;\r
}
public short getInfos() {
- return (short)infos;
+ return infos;
}
}
}
private void newGrid() {
- final int minRating = UserPreferences.getInstance().getInteger("minRating", 0);
- final int maxRating = UserPreferences.getInstance().getInteger("maxRating", Integer.MAX_VALUE);
+ final int minRating = UserPreferences.getInstance().getInteger("minRating", Integer.valueOf(0)).intValue();
+ final int maxRating = UserPreferences.getInstance().getInteger("maxRating", Integer.valueOf(Integer.MAX_VALUE)).intValue();
SudokuGrid grid = SudokuGeneratorFactory.getGenerator().generateGrid(minRating, maxRating);
for (int i = 0; i < cellInfos.length; i++) {
.println("GridModel.GridModel() length:" + strValues.length());
System.out.println("GridModel.GridModel() strValues:" + strValues);
for (int i = 0; i < strValues.length(); i++) {
- short value = Short.valueOf(strValues.substring(i, i + 1));
+ short value = Short.valueOf(strValues.substring(i, i + 1)).shortValue();
System.out.print(value);
cellInfos[i] = value;
if (1 <= value && value <= 9) {
static {\r
INSTANCE.set("minRating", Integer.valueOf(0));\r
INSTANCE.set("maxRating", Integer.valueOf(5700));\r
- INSTANCE.set("kanjiMode", Boolean.FALSE);\r
+ INSTANCE.set("numbersMode", Integer.valueOf(0));\r
}\r
\r
private final HashMap<String, Object> map = new HashMap<String, Object>();\r
\r
private boolean cancelRequested() {\r
synchronized (cancelled) {\r
- return cancelled;\r
+ return cancelled.booleanValue();\r
}\r
}\r
\r
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
-import javax.swing.Icon;
import javax.swing.JFrame;
@SuppressWarnings("serial")
private JFrame parent;
- public AboutAction(JFrame parent, SwingGrid grid, String string, Icon iconHelpAbout,
- String desc, Integer mnemonic) {
+ public AboutAction(JFrame parent) {
this.parent = parent;
}
private final Action actionResolve;
public CheatMenu(ActionsRepository actions, JFrame parent, GridView view) {
- actionSetMemosHere = new SetMemosHereAction(parent, _("Memos"),
+ actionSetMemosHere = new SetMemosHereAction(_("Memos"),
StockIcons.ICON_SET_MEMOS_HERE, _("Set memos"), new Integer(
KeyEvent.VK_T), view);
actions.put("SetMemosHere", actionSetMemosHere);
- actionSetAllMemos = new SetAllMemosAction(parent, _("All memos"),
+ actionSetAllMemos = new SetAllMemosAction(_("All memos"),
StockIcons.ICON_SET_ALL_MEMOS, _("Set memos in all cells"), new Integer(
KeyEvent.VK_X), view);
actions.put("SetAllMemos", actionSetAllMemos);
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+import java.net.UnknownHostException;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
result = 1;
}
} catch (InterruptedException e) {
- System.out
- .println("CheckUpdateDialog.worker.new SwingWorker() {...}.done() Interrupted !!!!");
} catch (ExecutionException e) {
- System.out
- .println("CheckUpdateDialog.worker.new SwingWorker() {...}.done() ExecutionException !!!!");
} catch (CancellationException e) {
- System.out
- .println("CheckUpdateDialog.worker.new SwingWorker() {...}.done() CancellationException !!!!");
result = -2;
} finally {
CheckUpdateDialog.this.dispose();
line = dis.readLine();
} catch (MalformedURLException mue) {
mue.printStackTrace();
+ } catch (UnknownHostException uhe) {
} catch (IOException ioe) {
- ioe.printStackTrace();
} finally {
try {
- dis.close();
+ if (dis != null) {
+ dis.close();
+ }
} catch (IOException e) {
e.printStackTrace();
}
\r
import javax.swing.AbstractAction;\r
import javax.swing.Icon;\r
-import javax.swing.JFrame;\r
\r
import net.jankenpoi.sudokuki.view.GridView;\r
\r
\r
private GridView view;\r
\r
- public ClearAllMovesAction(JFrame parent, String text, Icon icon,\r
+ public ClearAllMovesAction(String text, Icon icon,\r
String desc, Integer mnemonic, GridView view) {\r
super(text, icon);\r
\r
import javax.swing.AbstractAction;
import javax.swing.Icon;
-import javax.swing.JFrame;
import net.jankenpoi.sudokuki.view.GridView;
private GridView view;
- public CustomGridAction(JFrame parent, String text, Icon icon,
+ public CustomGridAction(String text, Icon icon,
String desc, Integer mnemonic, GridView view) {
super(text, icon);
getAccessibleContext().setAccessibleDescription(\r
"Edit menu");\r
\r
- actionClearAllMoves = new ClearAllMovesAction(parent, "Clear all moves",\r
+ actionClearAllMoves = new ClearAllMovesAction("Clear all moves",\r
StockIcons.ICON_CLEAR, "Clear all my moves", new Integer(\r
KeyEvent.VK_X), view);\r
actions.put("ClearAllMoves", actionClearAllMoves);\r
\r
- actionEraseAllMemos = new EraseAllMemosAction(parent, "Erase all memos",\r
+ actionEraseAllMemos = new EraseAllMemosAction("Erase all memos",\r
StockIcons.ICON_CLEAR_ALL_MEMOS, "Erase all memos...", new Integer(\r
KeyEvent.VK_X), view);\r
actions.put("EraseAllMemos", actionEraseAllMemos);\r
\r
- actionCustomGrid = new CustomGridAction(parent, "Custom grid",\r
+ actionCustomGrid = new CustomGridAction("Custom grid",\r
StockIcons.ICON_EDIT, "Compose a custom grid...", new Integer(\r
KeyEvent.VK_G), view);\r
actions.put("CustomGrid", actionCustomGrid);\r
\r
- actionPlayCustomGrid = new PlayCustomGridAction(parent, "Play custom grid",\r
+ actionPlayCustomGrid = new PlayCustomGridAction("Play custom grid",\r
StockIcons.ICON_PLAY, "Play with current grid...", new Integer(\r
KeyEvent.VK_H), view);\r
actions.put("PlayCustomGrid", actionPlayCustomGrid);\r
\r
import javax.swing.AbstractAction;\r
import javax.swing.Icon;\r
-import javax.swing.JFrame;\r
\r
import net.jankenpoi.sudokuki.view.GridView;\r
\r
\r
private GridView view;\r
\r
- public EraseAllMemosAction(JFrame parent, String text, Icon icon,\r
+ public EraseAllMemosAction(String text, Icon icon,\r
String desc, Integer mnemonic, GridView view) {\r
super(text, icon);\r
\r
\r
actionNew = new NewGridAction(parent, view, actions);\r
actions.put("NewGrid", actionNew);\r
- actionOpen = new OpenGridAction(parent, view, actions);\r
+ actionOpen = new OpenGridAction(parent, view);\r
actions.put("OpenGrid", actionOpen);\r
- actionSaveAs = new SaveAsAction(parent, view, actions);\r
+ actionSaveAs = new SaveAsAction(parent, view);\r
actions.put("SaveAs", actionSaveAs);\r
actionPrint = new PrintAction(grid);\r
actions.put("Print", actionPrint);\r
actionPrintMulti = new PrintMultiAction(parent, view);\r
- actions.put("PrintMulti", actionPrintMulti);;\r
+ actions.put("PrintMulti", actionPrintMulti);\r
addItems();\r
setL10nMessages(null, _("DETECTED_LANGUAGE"));\r
localeListener = new LocaleListenerImpl(this);\r
dispose();\r
}\r
\r
- private int generateGrid() {\r
+ private Integer generateGrid() {\r
view.getController().notifyNewGridRequested();\r
- return 0;\r
+ return Integer.valueOf(0);\r
}\r
\r
}\r
import net.jankenpoi.i18n.I18n;\r
import net.jankenpoi.i18n.LocaleListener;\r
import net.jankenpoi.sudokuki.ui.L10nComponent;\r
-import net.jankenpoi.sudokuki.view.GridView;\r
\r
@SuppressWarnings("serial")\r
public class HelpMenu extends JMenu implements L10nComponent {\r
actionAbout.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P));\r
}\r
\r
- HelpMenu(ActionsRepository actions, JFrame frame, SwingGrid grid, GridView view) {\r
+ HelpMenu(ActionsRepository actions, JFrame frame) {\r
this.parent = frame;\r
setMnemonic(KeyEvent.VK_H);\r
getAccessibleContext().setAccessibleDescription(\r
actionTranslate = new TranslateAction(parent);\r
actions.put("Translate", actionTranslate);\r
\r
- actionAbout = new AboutAction(parent, grid, "", null, "", Integer.valueOf(0));\r
+ actionAbout = new AboutAction(parent);\r
actions.put("About", actionAbout);\r
- addItems(view);\r
+ addItems();\r
setL10nMessages(null, _("DETECTED_LANGUAGE"));\r
localeListener = new LocaleListenerImpl(this);\r
I18n.addLocaleListener(localeListener);\r
}\r
\r
- private void addItems(GridView view) {\r
+ private void addItems() {\r
itemCheckUpdate.setAction(actionCheckUpdate);\r
add(itemCheckUpdate);\r
\r
}\r
\r
private void setLevelRatingBounds(final int minRating, final int maxRating) {\r
- UserPreferences.getInstance().set("minRating", minRating);\r
- UserPreferences.getInstance().set("maxRating", maxRating);\r
+ UserPreferences.getInstance().set("minRating", Integer.valueOf(minRating));\r
+ UserPreferences.getInstance().set("maxRating", Integer.valueOf(maxRating));\r
}\r
\r
}\r
add(new FileMenu(parent, actions, grid, view));\r
editMenu = new EditMenu(actions, parent, view);\r
add(editMenu);\r
- add(new HelpMenu(actions, parent, grid, view));\r
+ add(new HelpMenu(actions, parent));\r
}\r
\r
final CheatMenu getCheatMenu() {\r
private final JFrame frame;
- OpenGridAction(JFrame frame, GridView view, ActionsRepository actions) {
+ OpenGridAction(JFrame frame, GridView view) {
this.frame = frame;
this.view = view;
}
import javax.swing.AbstractAction;
import javax.swing.Icon;
-import javax.swing.JFrame;
import net.jankenpoi.sudokuki.view.GridView;
private GridView view;
- public PlayCustomGridAction(JFrame parent, String text, Icon icon,
+ public PlayCustomGridAction(String text, Icon icon,
String desc, Integer mnemonic, GridView view) {
super(text, icon);
@Override
public void actionPerformed(ActionEvent e) {
- ResolveGridDialog dlg = new ResolveGridDialog(frame, view, this);
+ ResolveGridDialog dlg = new ResolveGridDialog(frame, view);
dlg.setVisible(true);
int result = dlg.getResult();
if (result == 0) {
private final BruteForceGridSolver bruteSolver;\r
private final GridModel gridToSolve;\r
\r
- public ResolveGridDialog(JFrame parent, final GridView view,\r
- final ResolveAction resolveAction) {\r
+ public ResolveGridDialog(JFrame parent, final GridView view) {\r
\r
super(parent, true);\r
this.parent = parent;\r
/* Executed in the EDT, triggered when the SwingWorker has completed */\r
protected void done() {\r
try {\r
- status = get();\r
+ status = get().intValue();\r
} catch (InterruptedException e) {\r
e.printStackTrace();\r
return;\r
return status;\r
}\r
\r
- private int resolveGrid() {\r
+ private Integer resolveGrid() {\r
\r
GridSolution solution = bruteSolver.resolve();\r
if (solution == null) {\r
/**\r
* RESOLUTION PROCESS CANCELLED BEFORE COMPLETION\r
*/\r
- return 1;\r
+ return Integer.valueOf(1);\r
}\r
if (solution.isSolved()) {\r
GridModel solGrid = solution.getSolutionGrid();\r
/**\r
* RESOLUTION SUCCESSFULL\r
*/\r
- return 0;\r
+ return Integer.valueOf(0);\r
} else {\r
/**\r
* RESOLUTION PROCESS WAS UNABLE TO SOLVE THIS GRID\r
*/\r
- return 2;\r
+ return Integer.valueOf(2);\r
}\r
}\r
\r
private final GridView view;
private final JFrame frame;
- SaveAsAction(JFrame frame, GridView view, ActionsRepository actions) {
+ SaveAsAction(JFrame frame, GridView view) {
this.frame = frame;
this.view = view;
}
Iterator<Byte> it = memos.iterator();
while (it.hasNext()) {
- JToggleButton button = ckb[it.next()-1];
+ JToggleButton button = ckb[it.next().intValue()-1];
button.setSelected(true);
button.setFont(BOLD_FONT);
}
private void buttonClicked(int button) {
byte value = (byte)(button + 1);
if (ckb[button].isSelected()) {
- memos.add(value);
+ memos.add(Byte.valueOf(value));
ckb[button].setFont(BOLD_FONT);
} else {
- memos.remove(value);
+ memos.remove(Byte.valueOf(value));
ckb[button].setFont(NORMAL_FONT);
}
}
Iterator<Byte> it = memos.iterator();
int i = 0;
while (it.hasNext()) {
- memosArray[i] = it.next();
+ memosArray[i] = it.next().byteValue();
i++;
}
return memosArray;
\r
import javax.swing.AbstractAction;\r
import javax.swing.Icon;\r
-import javax.swing.JFrame;\r
\r
import net.jankenpoi.sudokuki.view.GridView;\r
\r
\r
private GridView view;\r
\r
- public SetAllMemosAction(JFrame parent, String text, Icon icon,\r
+ public SetAllMemosAction(String text, Icon icon,\r
String desc, Integer mnemonic, GridView view) {\r
super(text, icon);\r
\r
\r
import javax.swing.AbstractAction;\r
import javax.swing.Icon;\r
-import javax.swing.JFrame;\r
\r
import net.jankenpoi.sudokuki.view.GridView;\r
\r
\r
private GridView view;\r
\r
- public SetMemosHereAction(JFrame parent, String text, Icon icon,\r
+ public SetMemosHereAction(String text, Icon icon,\r
String desc, Integer mnemonic, GridView view) {\r
super(text, icon);\r
\r
public boolean isCellValueSet(int li, int co) {
for (byte v = 1; v<=9; v++) {
- if (isCellValueSet(li, co, v)) {
+ if (isCellValueSet(li, co, Byte.valueOf(v))) {
return true;
}
}