Class Piece

java.lang.Object
net.royalur.model.Piece

public class Piece extends Object
A piece on a board.
  • Constructor Details

    • Piece

      public Piece(PlayerType owner, int pathIndex)
      Instantiates a piece that can be placed on a board.
      Parameters:
      owner - The player that owns the piece.
      pathIndex - The index of this piece on its owner's path around the board.
  • Method Details

    • getOwner

      public PlayerType getOwner()
      Gets the player that owns this piece.
      Returns:
      The player that owns this piece.
    • getPathIndex

      public int getPathIndex()
      Gets the path index of this piece.
      Returns:
      The path index of this piece.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toChar

      public static char toChar(@Nullable Piece piece)
      Converts piece to a single character that can be used to textually represent the owner of a piece.
      Parameters:
      piece - The piece or null to convert to a character.
      Returns:
      The character representing piece.