Class Piece

java.lang.Object
javachess.model.Piece
Direct Known Subclasses:
Bishop, King, Knight, Pawn, Queen, Rook

public abstract class Piece extends Object
Abstract class representing a chess piece. This class serves as a base for all specific piece types (e.g., Pawn, Rook, Knight, etc.).
  • Field Details

  • Constructor Details

  • Method Details

    • getColor

      public PieceColor getColor()
    • hasMoved

      public boolean hasMoved()
    • setMoved

      public void setMoved()
    • getCell

      public Cell getCell()
    • getType

      public abstract PieceType getType()
    • getDecorator

      public PieceDecorator getDecorator()
    • findFile

      public String findFile()
      Finds the filename of the image representing the piece. The filename is constructed based on the color and type of the piece.
      Returns:
      The filename of the image representing the piece.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

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

      public void setCell(Cell cell)
    • getFEN

      public char getFEN()
      Returns the FEN character representing the piece.
      Returns:
      The FEN character representing the piece.