simulations.core
Class Player

java.lang.Object
  extended by simulations.core.Player
All Implemented Interfaces:
java.lang.Cloneable

public class Player
extends java.lang.Object
implements java.lang.Cloneable

This class describes a player of the game.


Constructor Summary
Player(java.lang.String name, float hitPoints, CompleteStrategy strategy)
          Creates a new instance of Player
Player(java.lang.String name, int hitPoints)
          Second constructor
 
Method Summary
 java.lang.Object clone()
          Returns the clone of the player
 boolean equals(java.lang.Object o)
          overload of equals() method.
 boolean equals2(java.lang.Object o)
          A second method to compare Players Return true if the players have same name and HP
 float getHitPoints()
          Getter for property hitPoints.
 java.lang.String getName()
          Getter for property name.
 CompleteStrategy getStrategy()
          Getter for property strategy.
 void setHitPoints(float hitPoints)
          Setter for property hitPoints.
 void setName(java.lang.String name)
          Setter for property name.
 void setStrategy(CompleteStrategy strategy)
          Setter for property strategy.
 java.lang.String toString()
          overload of toString() method.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Player

public Player(java.lang.String name,
              float hitPoints,
              CompleteStrategy strategy)
Creates a new instance of Player

Parameters:
name - The name of the player.
hitPoints - The hit points of the player.
strategy - The strategy of the player.

Player

public Player(java.lang.String name,
              int hitPoints)
Second constructor

Parameters:
name - The name of the player.
hitPoints - The HP of the player.
Method Detail

toString

public java.lang.String toString()
overload of toString() method.

Overrides:
toString in class java.lang.Object
Returns:
The name of the player.

getHitPoints

public float getHitPoints()
Getter for property hitPoints.

Returns:
Value of property hitPoints.

setHitPoints

public void setHitPoints(float hitPoints)
Setter for property hitPoints.

Parameters:
hitPoints - New value of property hitPoints.

getName

public java.lang.String getName()
Getter for property name.

Returns:
Value of property name.

setName

public void setName(java.lang.String name)
Setter for property name.

Parameters:
name - New value of property name.

getStrategy

public CompleteStrategy getStrategy()
Getter for property strategy.

Returns:
Value of property strategy.

setStrategy

public void setStrategy(CompleteStrategy strategy)
Setter for property strategy.

Parameters:
strategy - New value of property strategy.

clone

public java.lang.Object clone()
Returns the clone of the player

Overrides:
clone in class java.lang.Object
Returns:
Returns the clone of the player

equals

public boolean equals(java.lang.Object o)
overload of equals() method.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object to compare.
Returns:
true if the object is equals to the parameter.

equals2

public boolean equals2(java.lang.Object o)
A second method to compare Players Return true if the players have same name and HP

Parameters:
o - The object to compare.
Returns:
true if the object is equals to the parameter.