rules
Class UpRightRuleBean

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

public class UpRightRuleBean
extends AbRuleBean
implements java.io.Serializable

Created on November 3, 2006, 8:55 PM
Defines the rule for checking and flipping pieces in diagonal direction, up and right.

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

Constructor Summary
UpRightRuleBean()
          Creates a new instance of UpRightRuleBean
 
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

UpRightRuleBean

public UpRightRuleBean()
Creates a new instance of UpRightRuleBean

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.