Enum Class PlayerType

java.lang.Object
java.lang.Enum<PlayerType>
net.royalur.model.PlayerType
All Implemented Interfaces:
Serializable, Comparable<PlayerType>, Constable

public enum PlayerType extends Enum<PlayerType>
Represents the players of a game.
  • Enum Constant Details

    • LIGHT

      public static final PlayerType LIGHT
      The light player. Following chess, the light player moves first.
    • DARK

      public static final PlayerType DARK
      The dark player. Following chess, the dark player moves second.
  • Method Details

    • values

      public static PlayerType[] 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

      public static PlayerType valueOf(String name)
      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 name
      NullPointerException - 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

      public String getCharStr()
      Gets a constant character representing the player. This character will never change.
      Returns:
      A constant character representing the player.
    • getName

      public String getName()
      Gets the name of this player type.
      Returns:
      The name of this player type.
    • getOtherPlayer

      public PlayerType getOtherPlayer()
      Retrieves the PlayerType representing the other player.
      Returns:
      The PlayerType representing the other player.
    • toChar

      public static char toChar(@Nullable PlayerType player)
      Converts player to a single character that can be used to textually represent a piece.
      Parameters:
      player - The player or null to convert to a character.
      Returns:
      The character representing player.
    • getByChar

      public static PlayerType getByChar(char character)
      Finds the player associated with the given character.
      Parameters:
      character - The character associated with a player.
      Returns:
      The player associated with the given character.