|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.htwdd.rosenkoenig.game.Player
public abstract class Player
Abstract class for all players. Not an interface, as we need members. All player types must derive from this class.
| Field Summary | |
|---|---|
protected boolean |
canMove
|
protected java.util.ArrayList<Card> |
cards
|
protected Game |
game
|
protected boolean |
hasMoved
|
protected int |
highscore
|
protected int |
knights
|
protected java.lang.String |
name
|
protected int |
score
|
| Constructor Summary | |
|---|---|
Player()
Ctor, does nothing. |
|
| Method Summary | |
|---|---|
abstract org.jdom.Element |
createXml()
|
boolean |
equals(java.lang.Object other)
This function compares two players. |
protected abstract void |
extractPlayer(org.jdom.Element xmlPlayer)
|
boolean |
getCanMove()
Getter of the property canMove |
java.util.ArrayList<Card> |
getCards()
Getter of the property cards |
Game |
getGame()
Getter of the property game |
boolean |
getHasMoved()
Getter of the property hasMoved |
int |
getHighscore()
Getter of the property highscore |
int |
getKnights()
Getter of the property knights |
java.lang.String |
getName()
Getter of the property name |
int |
getNumberOfCards()
Return the number of cards of this player. |
int |
getScore()
Getter of the property score |
abstract boolean |
isInteractive()
If you derive from player and implement some kind of AI-player, return false here. |
static Player |
loadFromFile(java.io.File file)
Load a saved player from file. |
void |
saveToDir(java.lang.String directoryName)
Save a player to directoryName. |
void |
setCanMove(boolean canMove)
Setter of the property canMove |
void |
setCards(java.util.ArrayList<Card> cards)
Setter of the property cards |
void |
setGame(Game game)
Setter of the property game |
void |
setHasMoved(boolean hasMoved)
Setter of the property hasMoved |
void |
setHighscore(int highscore)
Setter of the property highscore |
void |
setKnights(int knights)
Setter of the property knights |
void |
setName(java.lang.String name)
Setter of the property name |
void |
setScore(int score)
Setter of the property score |
abstract void |
turn()
Deriving classes must do something in the turn function. |
void |
updateHighscore()
Update the player's highscore. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean hasMoved
protected boolean canMove
protected java.lang.String name
protected java.util.ArrayList<Card> cards
protected int knights
protected int score
protected int highscore
protected Game game
| Constructor Detail |
|---|
public Player()
| Method Detail |
|---|
public boolean getHasMoved()
public void setHasMoved(boolean hasMoved)
hasMoved - The hasMoved to set.public boolean getCanMove()
public void setCanMove(boolean canMove)
canMove - The canMove to set.public java.lang.String getName()
public void setName(java.lang.String name)
name - The name to set.public java.util.ArrayList<Card> getCards()
public int getKnights()
public void setKnights(int knights)
knights - The knights to set.public int getScore()
public void setScore(int score)
score - The score to set.public int getHighscore()
public void setHighscore(int highscore)
highscore - The highscore to set.public void updateHighscore()
public int getNumberOfCards()
public abstract void turn()
public void setCards(java.util.ArrayList<Card> cards)
cards - The cards to set.public Game getGame()
public void setGame(Game game)
game - The game to set.public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic abstract boolean isInteractive()
public static Player loadFromFile(java.io.File file)
file - The file the player is trapped in.
protected abstract void extractPlayer(org.jdom.Element xmlPlayer)
xmlPlayer - The xml portion of the player.
Implement this function, if you choose to save your player with several
properties to be loaded from an XML-filepublic final void saveToDir(java.lang.String directoryName)
directoryName - The obvious thing.public abstract org.jdom.Element createXml()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||