Package tetris.gui

Class Block

java.lang.Object
tetris.gui.Block

public class Block extends Object
The class Block implements a block of the Tetris game.
Version:
2.1
Author:
Stephan Fischli
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    The color of the block.
    int
    The x coordinate of the block.
    int
    The y coordinate of the block.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Block(int x, int y, int color)
    Constructs a block with the specified coordinates and color.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object object)
    Checks whether the block is equal to another block.
    int
    Computes a hash code of the block.

    Methods inherited from class java.lang.Object

    clone, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • x

      public int x
      The x coordinate of the block.
    • y

      public int y
      The y coordinate of the block.
    • color

      public int color
      The color of the block.
  • Constructor Details

    • Block

      public Block(int x, int y, int color)
      Constructs a block with the specified coordinates and color.
      Parameters:
      x - the x coordinate of the block
      y - the y coordinate of the block
      color - the color of the block
  • Method Details

    • equals

      public boolean equals(Object object)
      Checks whether the block is equal to another block.
      Overrides:
      equals in class Object
      Parameters:
      object - the other block
      Returns:
      true, if the blocks are equal, false otherwise
    • hashCode

      public int hashCode()
      Computes a hash code of the block.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code of the block