[gnome-sudoku] generator: make synchronous generation function private
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] generator: make synchronous generation function private
- Date: Sun, 28 Sep 2014 17:16:51 +0000 (UTC)
commit 692bf13e33b0c1cedeb328070ce15e2dfcf342fe
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Sep 28 12:07:34 2014 -0500
generator: make synchronous generation function private
To do this, make the GeneratorThread class a member of SudokuGenerator.
lib/sudoku-generator.vala | 60 ++++++++++++++++++++++----------------------
1 files changed, 30 insertions(+), 30 deletions(-)
---
diff --git a/lib/sudoku-generator.vala b/lib/sudoku-generator.vala
index 462332e..f5c2dcd 100644
--- a/lib/sudoku-generator.vala
+++ b/lib/sudoku-generator.vala
@@ -4,10 +4,39 @@ using Gee;
public class SudokuGenerator : Object
{
+ public class GeneratorThread : Object
+ {
+ private int nsudokus;
+ private DifficultyCategory level;
+ private Gee.List<SudokuBoard> boards_list;
+ private unowned SourceFunc callback;
+
+ public GeneratorThread (int nsudokus, DifficultyCategory level, Gee.List<SudokuBoard> boards_list,
SourceFunc callback)
+ {
+ this.nsudokus = nsudokus;
+ this.level = level;
+ this.boards_list = boards_list;
+ this.callback = callback;
+ }
+
+ public void* run ()
+ {
+ for (var i = 0; i < nsudokus; i++)
+ boards_list.add (SudokuGenerator.generate_board (level));
+
+ Idle.add(() => {
+ callback ();
+ return Source.REMOVE;
+ });
+
+ return null;
+ }
+ }
+
private SudokuGenerator () {
}
- public static SudokuBoard generate_board (DifficultyCategory category)
+ private static SudokuBoard generate_board (DifficultyCategory category)
{
var board = new SudokuBoard ();
int[] puzzle = QQwing.generate_puzzle ((int) category);
@@ -73,32 +102,3 @@ public class SudokuGenerator : Object
return QQwing.get_version ();
}
}
-
-public class GeneratorThread : Object
-{
- private int nsudokus;
- private DifficultyCategory level;
- private Gee.List<SudokuBoard> boards_list;
- private unowned SourceFunc callback;
-
- public GeneratorThread (int nsudokus, DifficultyCategory level, Gee.List<SudokuBoard> boards_list,
SourceFunc callback)
- {
- this.nsudokus = nsudokus;
- this.level = level;
- this.boards_list = boards_list;
- this.callback = callback;
- }
-
- public void* run ()
- {
- for (var i = 0; i < nsudokus; i++)
- boards_list.add (SudokuGenerator.generate_board (level));
-
- Idle.add(() => {
- callback ();
- return Source.REMOVE;
- });
-
- return null;
- }
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]