controller
Class Player

java.lang.Object
  extended by controller.Player

public class Player
extends java.lang.Object

ADT Player describes the characteristics of a player and provides modification methods.


Constructor Summary
Player(java.lang.String x, boolean z)
          constructor: Constructs a new Player with the given parameter String and Color.
 
Method Summary
 boolean getColor()
          accessor(selector): Returns the Color of the Player.
 java.lang.String getName()
          accessor(selector): Returns the name of the Player.
 boolean getTurn()
          accessor(selector): Returns a boolean value on whether a Player can or cannot play.
 void setTurn(boolean what)
          transformer(mutative): Is responsible for assigning whether its a Player's Turn.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player(java.lang.String x,
              boolean z)
constructor: Constructs a new Player with the given parameter String and Color.
precondition: x and z parameters can't be null, Color must black or white(true for white, false for black). Also x cannot be the empty string.
postcondition: Creates and initializes a player with the given name and Color. If x is null throws NullPointerException. If x is the empty String, IllegalArgumentException is thrown.

Parameters:
x - Is the parameter String name of the Player.
z - Is the Color of the Player's pieces'(true for white,false for black).
Throws:
java.lang.IllegalArgumentException - If x is empty.
java.lang.NullPointerException - If x is null.
Method Detail

getColor

public boolean getColor()
accessor(selector): Returns the Color of the Player.
postcondition: Returns Color (black or white) of the Player (true for white, false for black).

Returns:
Color(true for white, false for black) of the player.

setTurn

public void setTurn(boolean what)
transformer(mutative): Is responsible for assigning whether its a Player's Turn. Parameter's what value, if true states that Player is eligible to play, if false he's ineligible.
postcondition: Decides to set a Player's turn based on the parameter value. True will make the Player eligible to play, false will not permit him to play.

Parameters:
what - to assign on whether it's a Player's turn. True if it is, false otherwise.

getTurn

public boolean getTurn()
accessor(selector): Returns a boolean value on whether a Player can or cannot play. True if a player can play, false other wise.
postcondition: Returns a boolean value, if it's Player's turn true, false otherwise.

Returns:
True notifying if it's the Player's turn, false otherwise.

getName

public java.lang.String getName()
accessor(selector): Returns the name of the Player.
postcondition: Returns the name of the given Player.

Returns:
String Name of Player