Class Mediator

java.lang.Object
  |
  +--java.awt.event.MouseAdapter
        |
        +--Mediator

public class Mediator
extends java.awt.event.MouseAdapter

This class handles mouse clicks on a position. A position must know the state of other positions in order to know whether it can be occupied. This class serves as a mediator among positions.


Constructor Summary
Mediator(Position[][] cell, int row, int col)
          Construct a position.
 
Method Summary
 void mouseClicked(java.awt.event.MouseEvent evt)
          Event Handler.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseEntered, mouseExited, mousePressed, mouseReleased
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mediator

public Mediator(Position[][] cell,
                int row,
                int col)
Construct a position.
Parameters:
cell - The array of positions of the board.
row - The row of the position this listenet listen to.
col - The col of the position this listenet listen to.
Method Detail

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
Event Handler. If the clicked position is empty and can be occupied, the position is occupied and all other positions involved in the move are flipped.
Overrides:
mouseClicked in class java.awt.event.MouseAdapter
Parameters:
evt - The mouse click event of the position this listener is listening to.