jaige
Class Player

java.lang.Object
  extended by jaige.Player
Direct Known Subclasses:
AI

public class Player
extends java.lang.Object

This class is used to represent a player in the Jaige games. By itself, it represents a human player. The AI class extends Player, and is used to represent AI's.

Copyright (c) Jaige 2007

Version:
1.0
Author:
Rob Taft

Constructor Summary
Player()
          Creates a player with the default name "No name" and the default color of Color.RED.
Player(java.lang.String name, java.awt.Color color)
          Creates a player with the specified name and color.
 
Method Summary
 java.awt.Color getColor()
          Gets the color of this player.
 java.lang.String getName()
          Returns the name of this Player.
 Orientation getOrientation()
          Gets the orientation of this player.
 void setColor(java.awt.Color color)
          Sets the color of this player.
 void setName(java.lang.String name)
          Sets the name of this player.
 void setOrientation(Orientation orientation)
          Sets the orientation of this player.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player()
Creates a player with the default name "No name" and the default color of Color.RED.


Player

public Player(java.lang.String name,
              java.awt.Color color)
Creates a player with the specified name and color.

Parameters:
name - String The name of this Player.
color - Color The desired color of this player. @see setColor
See Also:
setColor
Method Detail

getName

public java.lang.String getName()
Returns the name of this Player.

Returns:
String The name of this player.

setName

public void setName(java.lang.String name)
Sets the name of this player.

Parameters:
name - String The new name of this player.

getColor

public java.awt.Color getColor()
Gets the color of this player. The color returned is the color set in the constructor or from the setColor method. Some games call setColor to garauntee the players are different colors. You can over ride this method to force the player to be a certain color. This is not advisable for games where certain colors are expected ie. Chess expects Color.BLACK and Color.WHITE.

Returns:
Color The color of this player.

setColor

public void setColor(java.awt.Color color)
Sets the color of this player. This will have no effect on subclasses that override the getColor method.

Parameters:
color - Color The new color of this Player.

getOrientation

public Orientation getOrientation()
Gets the orientation of this player.

Returns:
Orientation The orientation of this player.
See Also:
Orientation

setOrientation

public void setOrientation(Orientation orientation)
Sets the orientation of this player. This is generally called by the games and should not be called by subclasses

Parameters:
orientation - Orientation