checkers.model
Class ForceJumpValidator

java.lang.Object
  extended by checkers.model.Rules
      extended by checkers.model.ForceJumpValidator
All Implemented Interfaces:
CheckersConstants

public class ForceJumpValidator
extends Rules
implements CheckersConstants

This class is used to check for force jumps. In the case where force jumps exist the move provided is checked to make sure that it is a force jump.


Field Summary
 
Fields inherited from interface checkers.CheckersConstants
ACCEPT, BLUE, CLIENTGAME, DRAW, HOST, HOSTGAME, JOIN, KING, LOCAL, LOCALGAME, NUM_SPACES, PLAYER1SET, PLAYER2SET, RESIGN, SINGLE, UPDATE, WHITE
 
Constructor Summary
ForceJumpValidator()
          Constructor
 
Method Summary
 boolean pieceHasForceJumps(int pos)
          pieceHasForceJumps Check whether a piece has any force jumps.
 boolean validateMove(Move move)
          validateMove Validates that the move is a force jump if force jumps exist.
 
Methods inherited from class checkers.model.Rules
getInstance, getJumpIndex, isJump, setBoard
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForceJumpValidator

public ForceJumpValidator()
Constructor

Method Detail

validateMove

public boolean validateMove(Move move)
validateMove Validates that the move is a force jump if force jumps exist. If no force jumps exist the move is validated normally.

Overrides:
validateMove in class Rules
Parameters:
move - the move to be validated
Returns:
returns true if the move is valid

pieceHasForceJumps

public boolean pieceHasForceJumps(int pos)
pieceHasForceJumps Check whether a piece has any force jumps. If it does, store the start position in the collection along with its corresponding end position in the other list

Parameters:
pos - the position on the board that needs to be checked