Package net.royalur.model
Enum Class PlayerType
- All Implemented Interfaces:
Serializable,Comparable<PlayerType>,Constable
Represents the players of a game.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic PlayerTypegetByChar(char character) Finds the player associated with the given character.chargetChar()Gets a constant character representing the player.Gets a constant character representing the player.getName()Gets the name of this player type.Retrieves the PlayerType representing the other player.static chartoChar(PlayerType player) Convertsplayerto a single character that can be used to textually represent a piece.static PlayerTypeReturns the enum constant of this class with the specified name.static PlayerType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
LIGHT
The light player. Following chess, the light player moves first. -
DARK
The dark player. Following chess, the dark player moves second.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getChar
public char getChar()Gets a constant character representing the player. This character will never change.- Returns:
- A constant character representing the player.
-
getCharStr
Gets a constant character representing the player. This character will never change.- Returns:
- A constant character representing the player.
-
getName
Gets the name of this player type.- Returns:
- The name of this player type.
-
getOtherPlayer
Retrieves the PlayerType representing the other player.- Returns:
- The PlayerType representing the other player.
-
toChar
Convertsplayerto a single character that can be used to textually represent a piece.- Parameters:
player- The player ornullto convert to a character.- Returns:
- The character representing
player.
-
getByChar
Finds the player associated with the given character.- Parameters:
character- The character associated with a player.- Returns:
- The player associated with the given character.
-