[gnome-sudoku/vala-port] Port to gee-0.8
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku/vala-port] Port to gee-0.8
- Date: Sun, 17 Nov 2013 00:51:15 +0000 (UTC)
commit a97cf6328c589771ba211b07c71894153d07b467
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sat Nov 16 18:49:00 2013 -0600
Port to gee-0.8
Newer versions of libgee ship a gee-0.8 pkg-config, older versions ship
a gee-1.0 pkg-config. Yes, this is an upgrade. No, it does not make
sense.
configure.ac | 2 +-
src/Makefile.am | 2 +-
src/logical-sudoku-solver.vala | 4 ++--
src/sudoku-board.vala | 14 +++++++-------
src/sudoku-solver.vala | 13 ++++++-------
5 files changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6797c50..f594fe2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ GTK_REQUIRED=3.4.0
PKG_CHECK_MODULES(GNOME_SUDOKU, [
gio-2.0
gtk+-3.0 >= $GTK_REQUIRED
- gee-1.0
+ gee-0.8
])
AC_PATH_PROG([APPDATA_VALIDATE], [appdata-validate], [/bin/true])
diff --git a/src/Makefile.am b/src/Makefile.am
index a0d6164..7fef030 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,7 +31,7 @@ gnome_sudoku_VALAFLAGS = \
--pkg posix \
--pkg gio-2.0 \
--pkg gtk+-3.0 \
- --pkg gee-1.0
+ --pkg gee-0.8
gnome-sudoku-resources.c: gnome-sudoku.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES)
--generate-dependencies gnome-sudoku.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $<
diff --git a/src/logical-sudoku-solver.vala b/src/logical-sudoku-solver.vala
index 6163ac1..5206ee5 100644
--- a/src/logical-sudoku-solver.vala
+++ b/src/logical-sudoku-solver.vala
@@ -68,7 +68,7 @@ class LogicalSudokuSolver
private void fill_possibility_arrays () {
row_possibilities = new ArrayList<Coord?>[board.rows, board.max_val + 1];
col_possibilities = new ArrayList<Coord?>[board.cols, board.max_val + 1];
- block_possibilities = new HashMap<Coord?, ArrayList<ArrayList<Coord?>>> ((GLib.HashFunc) Coord.hash,
(GLib.EqualFunc) Coord.equal);
+ block_possibilities = new HashMap<Coord?, ArrayList<ArrayList<Coord?>>> ((HashDataFunc<Coord>)
Coord.hash, (EqualDataFunc<Coord>) Coord.equal);
for (int row = 0; row < board.rows; row++) {
for (int col = 0; col < board.cols; col++) {
@@ -156,7 +156,7 @@ class LogicalSudokuSolver
if (open_squares[initial_coord] == null || open_squares[initial_coord].size < 2)
continue;
- ArrayList<Coord?> subset_coords = new ArrayList<Coord?> ((GLib.EqualFunc) Coord.equal);
+ ArrayList<Coord?> subset_coords = new ArrayList<Coord?> ((EqualDataFunc<Coord>) Coord.equal);
subset_coords.add (initial_coord);
int subset_size = open_squares[initial_coord].size;
diff --git a/src/sudoku-board.vala b/src/sudoku-board.vala
index e059651..470595d 100644
--- a/src/sudoku-board.vala
+++ b/src/sudoku-board.vala
@@ -105,12 +105,12 @@ public class SudokuBoard
}
}
- broken_coords = new HashSet<Coord?>((GLib.HashFunc) Coord.hash, (GLib.EqualFunc) Coord.equal);
+ broken_coords = new HashSet<Coord?>((HashDataFunc<Coord>) Coord.hash, (EqualDataFunc<Coord>)
Coord.equal);
coords_for_col = new ArrayList<ArrayList<Coord?>> ();
for (int col = 0; col < _cols; col++)
{
- coords_for_col.add (new ArrayList<Coord?> ((GLib.EqualFunc) Coord.equal));
+ coords_for_col.add (new ArrayList<Coord?> ((EqualDataFunc<Coord>) Coord.equal));
for (int row = 0; row < _rows; row++)
{
coords_for_col.get (col).add (Coord(row, col));
@@ -122,7 +122,7 @@ public class SudokuBoard
coords_for_row = new ArrayList<ArrayList<Coord?>> ();
for (int row = 0; row < _rows; row++)
{
- coords_for_row.add (new ArrayList<Coord?> ((GLib.EqualFunc) Coord.equal));
+ coords_for_row.add (new ArrayList<Coord?> ((EqualDataFunc<Coord>) Coord.equal));
for (int col = 0; col < _cols; col++)
{
coords_for_row.get (row).add (Coord(row, col));
@@ -131,12 +131,12 @@ public class SudokuBoard
}
coords_for_row = coords_for_row.read_only_view;
- coords_for_block = new HashMap<Coord?, ArrayList<Coord?>> ((GLib.HashFunc) Coord.hash,
(GLib.EqualFunc) Coord.equal);
+ coords_for_block = new HashMap<Coord?, ArrayList<Coord?>> ((HashDataFunc<Coord>) Coord.hash,
(EqualDataFunc<Coord>) Coord.equal);
for (int col = 0; col < _block_cols; col++)
{
for (int row = 0; row < _block_rows; row++)
{
- coords_for_block.set (Coord(row, col), new ArrayList<Coord?> ((GLib.EqualFunc) Coord.equal));
+ coords_for_block.set (Coord(row, col), new ArrayList<Coord?> ((EqualDataFunc<Coord>)
Coord.equal));
}
}
for (int col = 0; col < _cols; col++)
@@ -351,7 +351,7 @@ public class SudokuBoard
public Set<Coord?> get_occurances(Gee.List<Coord?> coords, int val)
{
- Set<Coord?> occurances = new HashSet<Coord?>((GLib.HashFunc) Coord.hash, (GLib.EqualFunc)
Coord.equal);
+ Set<Coord?> occurances = new HashSet<Coord?>((HashDataFunc<Coord>) Coord.hash,
(EqualDataFunc<Coord>) Coord.equal);
foreach (Coord coord in coords)
{
if (cells[coord.row, coord.col] == val) {
@@ -451,7 +451,7 @@ public class SudokuBoard
}
public HashMap<Coord?, ArrayList<int>> calculate_open_squares () {
- var possibilities = new HashMap<Coord?, ArrayList<int>> ((GLib.HashFunc) Coord.hash,
(GLib.EqualFunc) Coord.equal);
+ var possibilities = new HashMap<Coord?, ArrayList<int>> ((HashDataFunc<Coord>) Coord.hash,
(EqualDataFunc<Coord>) Coord.equal);
for (var l1 = 0; l1 < _rows; l1++)
{
for (var l2 = 0; l2 < _cols; l2++)
diff --git a/src/sudoku-solver.vala b/src/sudoku-solver.vala
index f732ce3..64c02aa 100644
--- a/src/sudoku-solver.vala
+++ b/src/sudoku-solver.vala
@@ -277,10 +277,10 @@ public class SudokuSolver
return new ArrayList<Cell?> ();
// This list holds the changes that are made to the board
- ArrayList<Cell?> changed = new ArrayList<Cell?> ((GLib.EqualFunc) Coord.equal);
+ ArrayList<Cell?> changed = new ArrayList<Cell?> ((EqualDataFunc<Coord>) Coord.equal);
// Maps the number needed to a cell that can hold it
- var needs = new HashMap<int, Coord?> (null, null, (GLib.EqualFunc) Coord.equal);
+ var needs = new HashMap<int, Coord?> (null, null, (EqualDataFunc<Coord>) Coord.equal);
for (int i=1; i <= board.max_val; i++)
needs[i] = null;
@@ -350,7 +350,6 @@ public class SudokuSolver
// Find the square with the least possibilties
MapIterator<Coord?, ArrayList<int>> iter = poss.map_iterator ();
- iter.first ();
Coord least_coord = iter.get_key ();
ArrayList<int> least_coord_possibilties = iter.get_value ();
@@ -500,7 +499,7 @@ class SudokuRater : SudokuSolver {
guessing = false;
fake_add = false;
fake_additions = new ArrayList<Cell?> ();
- filled = new HashSet<Cell?> ((GLib.HashFunc) Cell.hash, (GLib.EqualFunc) Cell.equal);
+ filled = new HashSet<Cell?> ((HashDataFunc<Coord>) Cell.hash, (EqualDataFunc<Coord>) Cell.equal);
fill_must_fillables = new HashMap<int, HashSet<Cell?>> ();
elimination_fillables = new HashMap<int, HashSet<Cell?>> ();
tier = 0;
@@ -541,7 +540,7 @@ class SudokuRater : SudokuSolver {
fill_must_fills();
} catch (SudokuError e) {
}
- fill_must_fillables[tier] = new HashSet<Cell?> ((GLib.HashFunc) Cell.hash, (GLib.EqualFunc)
Cell.equal);
+ fill_must_fillables[tier] = new HashSet<Cell?> ((HashDataFunc<Coord>) Cell.hash,
(EqualDataFunc<Coord>) Cell.equal);
foreach (Cell cell in fake_additions) {
if (!filled.contains(cell))
fill_must_fillables[tier].add (cell);
@@ -555,7 +554,7 @@ class SudokuRater : SudokuSolver {
} catch (SudokuError e) {
}
- elimination_fillables[tier] = new HashSet<Cell?> ((GLib.HashFunc) Cell.hash, (GLib.EqualFunc)
Cell.equal);
+ elimination_fillables[tier] = new HashSet<Cell?> ((HashDataFunc<Coord>) Cell.hash,
(EqualDataFunc<Coord>) Cell.equal);
foreach (Cell cell in fake_additions) {
if (!filled.contains(cell))
elimination_fillables[tier].add (cell);
@@ -642,7 +641,7 @@ public class Guess {
_row = row;
_col = col;
_val = val;
- consequences = new HashMap<Coord?, int> ((GLib.HashFunc) Coord.hash, (GLib.EqualFunc) Coord.equal);
+ consequences = new HashMap<Coord?, int> ((HashDataFunc<Coord>) Coord.hash, (EqualDataFunc<Coord>)
Coord.equal);
children = new ArrayList<Guess> ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]