[gnome-sudoku] Use namespace instead of class for SudokuGenerator
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku] Use namespace instead of class for SudokuGenerator
- Date: Thu, 28 Jul 2016 04:44:21 +0000 (UTC)
commit 6e9ea26ef0eb8dfe9b95723e71ec32e53f986167
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Wed Jul 27 23:42:16 2016 -0500
Use namespace instead of class for SudokuGenerator
This class contains only constants and static functions, so generating a
ton of GObject code here for an object that never gets instantiated is
way overkill. Use namespace instead of class to clarify this.
lib/sudoku-generator.vala | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/lib/sudoku-generator.vala b/lib/sudoku-generator.vala
index d5c69f1..4368862 100644
--- a/lib/sudoku-generator.vala
+++ b/lib/sudoku-generator.vala
@@ -21,7 +21,7 @@
using Gee;
-public class SudokuGenerator : Object
+namespace SudokuGenerator
{
private class Worker : Object
{
@@ -60,11 +60,7 @@ public class SudokuGenerator : Object
}
}
- private SudokuGenerator ()
- {
- }
-
- private static SudokuBoard generate_board (DifficultyCategory category)
+ private SudokuBoard generate_board (DifficultyCategory category)
{
var board = new SudokuBoard ();
int[] puzzle = new int[board.rows * board.cols];
@@ -83,7 +79,8 @@ public class SudokuGenerator : Object
return board;
}
- public async static Gee.List<SudokuBoard> generate_boards_async (int nboards, DifficultyCategory
category, Cancellable? cancellable) throws ThreadError, IOError
+ public async Gee.List<SudokuBoard> generate_boards_async (
+ int nboards, DifficultyCategory category, Cancellable? cancellable) throws ThreadError, IOError
{
var boards = new ArrayList<SudokuBoard> ();
var pool = new ThreadPool<Worker>.with_owned_data ((worker) => {
@@ -107,7 +104,7 @@ public class SudokuGenerator : Object
return boards;
}
- public static void print_stats (SudokuBoard board)
+ public void print_stats (SudokuBoard board)
{
var cells = board.get_cells ();
var puzzle = new int[board.rows * board.cols];
@@ -119,7 +116,7 @@ public class SudokuGenerator : Object
QQwing.print_stats (puzzle);
}
- public static string qqwing_version ()
+ public string qqwing_version ()
{
return QQwing.get_version ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]