rules
Class DownRightRuleBean

java.lang.Object
  extended by rules.AbRuleBean
      extended by rules.DownRightRuleBean
All Implemented Interfaces:
java.io.Serializable

public class DownRightRuleBean
extends AbRuleBean
implements java.io.Serializable

Created on November 3, 2006, 9:35 PM
Defines the rule for checking and flipping pieces in diagonal direction, down and right.

Version:
t.4
Author:
Eric Angeli
See Also:
Serialized Form

Constructor Summary
DownRightRuleBean()
          Creates a new instance of DownRightRuleBean
 
Method Summary
 void flipPieces(OthelloCell[][] cells, java.awt.Point cp, java.lang.String placed)
          Loops through all the starting from the cell specified and flips the pieces if valid.
 boolean validate(OthelloCell[][] cells, java.awt.Point cp, java.lang.String placed)
          Validates the point, based on the current game board and the color.
 
Methods inherited from class rules.AbRuleBean
addPropertyChangeListener, getPropertySupport, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownRightRuleBean

public DownRightRuleBean()
Creates a new instance of DownRightRuleBean

Method Detail

validate

public boolean validate(OthelloCell[][] cells,
                        java.awt.Point cp,
                        java.lang.String placed)
Validates the point, based on the current game board and the color.

Specified by:
validate in class AbRuleBean
Parameters:
cells - The game baord to validate.
cp - The point to be validated.
placed - The color placed on the board.
Returns:
True if valid, flas if not.

flipPieces

public void flipPieces(OthelloCell[][] cells,
                       java.awt.Point cp,
                       java.lang.String placed)
Loops through all the starting from the cell specified and flips the pieces if valid.

Specified by:
flipPieces in class AbRuleBean
Parameters:
cells - The game board to modify.
cp - The origin of the flipping.
placed - The color placed.