game.checkers
Class Checker

java.lang.Object
  extended bygame.checkers.Checker
All Implemented Interfaces:
Piece

public class Checker
extends Object
implements Piece

Checker represents a checker piece (either red or black).


Constructor Summary
Checker(CheckerColor color)
          Make a Checker.
 
Method Summary
 CheckerColor getColor()
          Get checker's color.
 boolean similar(Object obj)
          Test if obj is a similar kind of checker.
 String toString()
          Get checker's string representation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface game.Piece
equals, hashCode
 

Constructor Detail

Checker

public Checker(CheckerColor color)
Make a Checker.

Parameters:
color - checker's color: either CheckerColor.RED or CheckerColor.BLACK
Method Detail

getColor

public CheckerColor getColor()
Get checker's color.

Returns:
color, either CheckerColor.RED or CheckerColor.BLACK

toString

public String toString()
Get checker's string representation.

Specified by:
toString in interface Piece
Returns:
"R" for a red checker, "b" for black

similar

public boolean similar(Object obj)
Test if obj is a similar kind of checker.

Specified by:
similar in interface Piece
Parameters:
obj - Object to test
Returns:
true if obj is a Checker of the same color as this checker