Class Piece

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class Piece
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable
    A piece for playing.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean white
      The piece color (white or black).
    • Constructor Summary

      Constructors 
      Constructor Description
      Piece()
      Create a new piece.
      Piece​(boolean white)
      Create a new board.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Clone the object.
      boolean isWhite()
      Test, if it is a white piece.
      void setWhite​(boolean white)
      Set tu true, if it is a white piece.
      java.lang.String toString()
      Get the string representation.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • white

        protected boolean white
        The piece color (white or black).
    • Constructor Detail

      • Piece

        public Piece()
        Create a new piece.
      • Piece

        public Piece​(boolean white)
        Create a new board.
    • Method Detail

      • isWhite

        public boolean isWhite()
        Test, if it is a white piece.
        Returns:
        True, if it a white piece.
      • setWhite

        public void setWhite​(boolean white)
        Set tu true, if it is a white piece.
      • toString

        public java.lang.String toString()
        Get the string representation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation.
      • clone

        public java.lang.Object clone()
        Clone the object.
        Overrides:
        clone in class java.lang.Object
        Returns:
        The clone.