[gnome-sudoku] SudokuGame: type cleanups



commit 503ff16087cf3b9cdd4d8522edc5435b766e5ab0
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Oct 4 16:42:14 2014 -0500

    SudokuGame: type cleanups
    
    None of this code is specific to ArrayLists, and classes are already
    reference types.

 lib/sudoku-game.vala      |   16 ++++++++--------
 lib/sudoku-generator.vala |    2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/lib/sudoku-game.vala b/lib/sudoku-game.vala
index 6dd2788..82df700 100644
--- a/lib/sudoku-game.vala
+++ b/lib/sudoku-game.vala
@@ -50,8 +50,8 @@ public class SudokuGame : Object
 
     public signal void cell_changed (int row, int col, int old_val, int new_val);
 
-    private ArrayList<UndoItem?> undostack;
-    private ArrayList<UndoItem?> redostack;
+    private Gee.List<UndoItem?> undostack;
+    private Gee.List<UndoItem?> redostack;
 
     public bool is_undostack_null ()
     {
@@ -90,12 +90,12 @@ public class SudokuGame : Object
 
     public void undo ()
     {
-        apply_stack (ref undostack, ref redostack);
+        apply_stack (undostack, redostack);
     }
 
     public void redo ()
     {
-        apply_stack (ref redostack, ref undostack);
+        apply_stack (redostack, undostack);
     }
 
     public void reset ()
@@ -125,24 +125,24 @@ public class SudokuGame : Object
 
     public void update_undo (int row, int col, int old_val, int new_val)
     {
-        add_to_stack (ref undostack, row, col, old_val);
+        add_to_stack (undostack, row, col, old_val);
         redostack.clear ();
     }
 
-    private void add_to_stack (ref ArrayList<UndoItem?> stack, int r, int c, int v)
+    private void add_to_stack (Gee.List<UndoItem?> stack, int r, int c, int v)
     {
         UndoItem step = { r, c, v };
         stack.add (step);
     }
 
-    private void apply_stack (ref ArrayList<UndoItem?> from, ref ArrayList<UndoItem?> to)
+    private void apply_stack (Gee.List<UndoItem?> from, Gee.List<UndoItem?> to)
     {
         if (from.size == 0)
             return;
 
         var top = from.remove_at (from.size - 1);
         int old_val = board [top.row, top.col];
-        add_to_stack (ref to, top.row, top.col, old_val);
+        add_to_stack (to, top.row, top.col, old_val);
         board.remove (top.row, top.col);
         if (top.val != 0)
             board.insert (top.row, top.col, top.val);
diff --git a/lib/sudoku-generator.vala b/lib/sudoku-generator.vala
index 5909ac5..da35d5f 100644
--- a/lib/sudoku-generator.vala
+++ b/lib/sudoku-generator.vala
@@ -74,7 +74,7 @@ public class SudokuGenerator : Object
 
     public async static SudokuBoard[] generate_boards_async (int nboards, DifficultyCategory category) 
throws ThreadError
     {
-        var boards_list = new ConcurrentList<SudokuBoard> ();
+        var boards_list = new ArrayList<SudokuBoard> ();
         var boards = new SudokuBoard[nboards];
         var threads = new ArrayList<Thread<void*>> ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]