ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/Microscope.java
(Generate patch)

Comparing jsr166/src/test/loops/Microscope.java (file contents):
Revision 1.6 by jsr166, Tue Mar 15 19:47:05 2011 UTC vs.
Revision 1.12 by jsr166, Wed Dec 31 17:00:58 2014 UTC

# Line 5 | Line 5
5   */
6  
7   import java.awt.*;
8 import javax.swing.*;
9 import java.util.*;
8   import java.awt.event.*;
9 < import javax.swing.event.*;
9 > import java.util.*;
10   import java.util.concurrent.*;
11 + import javax.swing.*;
12 + import javax.swing.event.*;
13  
14  
15   /**
# Line 242 | Line 242 | public class Microscope extends JPanel {
242          if (lookAheads <= 1) lookAheads = 2;
243      }
244  
245 <    public int level () { return Microscope.lookAheads; }
245 >    public int level() { return Microscope.lookAheads; }
246  
247  
248      // process a move (called only from mover)
# Line 479 | Line 479 | public class Microscope extends JPanel {
479       * threads (instead new ones are constructed), so don't
480       * need any synch.
481       */
482 <    static final class Board   {
482 >    static final class Board {
483  
484          /*
485             First, some Constants and utilities that might as well be here
# Line 606 | Line 606 | public class Microscope extends JPanel {
606          // place a tile, taking all adjacent tiles of opponent
607  
608          public void take(Player player, int row, int col) {
609 <            int k =  (row + col * RANKS);
609 >            int k = row + col * RANKS;
610              long dest = 1L << k;
611              long nbrMask = adjacentMasks[k];
612              long sourceBlue = blue_;
# Line 617 | Line 617 | public class Microscope extends JPanel {
617              }
618              else {
619                  blue_ = sourceBlue & ~(sourceBlue & nbrMask);
620 <                green_ =  sourceGreen | dest | (sourceBlue & nbrMask);
620 >                green_ = sourceGreen | dest | (sourceBlue & nbrMask);
621              }
622          }
623  
# Line 751 | Line 751 | public class Microscope extends JPanel {
751  
752          // setters:
753  
754 <        synchronized void player(Player p)       { player_ = p;  }
755 <        synchronized void board(Board b)         { board_ = b;  }
756 <        synchronized void from(int sr, int sc)   { fromRow = sr; fromCol = sc;  }
754 >        synchronized void player(Player p)       { player_ = p; }
755 >        synchronized void board(Board b)         { board_ = b; }
756 >        synchronized void from(int sr, int sc)   { fromRow = sr; fromCol = sc; }
757          synchronized void to(int dr, int dc)     { toRow = dr;   toCol = dc; }
758  
759          //  accessors:
# Line 761 | Line 761 | public class Microscope extends JPanel {
761          synchronized boolean isFrom(int r, int c) {
762              return fromRow== r && fromCol == c;
763          }
764 <        synchronized boolean isTo(int r, int c)   {
764 >        synchronized boolean isTo(int r, int c) {
765              return toRow == r && toCol == c;
766          }
767          synchronized Board board() {
# Line 1005 | Line 1005 | public class Microscope extends JPanel {
1005              Finder forked = null; // list of forked subtasks when level > 1
1006  
1007              long open = ~(ours | theirs);  // currently empty cells
1008 <            long here = 1;                 // travserse through bits
1008 >            long here = 1;                 // traverse through bits
1009  
1010              for (int k = 0; k < Board.CELLS; ++k, here <<= 1) {
1011                  if ((here & ours) != 0) {
# Line 1173 | Line 1173 | public class Microscope extends JPanel {
1173                  long nextOurs = bestFinder.theirs;
1174                  long nextTheirs = bestFinder.ours;
1175                  long blue = player.isBlue() ? nextOurs : nextTheirs;
1176 <                long green = player.isBlue() ? nextTheirs: nextOurs;
1176 >                long green = player.isBlue() ? nextTheirs : nextOurs;
1177                  move = new Move(player, new Board(blue, green), true);
1178              }
1179              automover.relay(move);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines