Class GamePiece

java.lang.Object
GamePiece

public class GamePiece extends Object
The GamePiece tile object for the Tetravex game. Stores four values: north, south, east, and west representing the top, bottom, right, and left edge of the tile.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
    Data fields for the north, south, east, west values respectively.
    private int
    A unique identifier for the GamePiece
    private int
    Data fields for the north, south, east, west values respectively.
    static int
    The number of GamePiece objects created.
    private int
    Data fields for the north, south, east, west values respectively.
    static final int
    Number of possible values at each position.
    private int
    Data fields for the north, south, east, west values respectively.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a GamePiece object with random values.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the east value of the GamePiece.
    int
    Get the id number of the GamePiece
    int
    Gets the north value of the GamePiece.
    int
    Gets the south value of the GamePiece.
    int
    Gets the west value of the GamePiece.
    void
    setEast(int east)
    Sets the east value of the GamePiece.
    void
    setNorth(int north)
    Sets the north value of the GamePiece.
    void
    setSouth(int south)
    Sets the south value of the GamePiece.
    void
    setWest(int west)
    Sets the west value of the GamePiece.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • VALUES

      public static final int VALUES
      Number of possible values at each position.
      See Also:
    • NUM_PIECES

      public static int NUM_PIECES
      The number of GamePiece objects created. Used to generate id numbers.
    • north

      private int north
      Data fields for the north, south, east, west values respectively.
    • south

      private int south
      Data fields for the north, south, east, west values respectively.
    • east

      private int east
      Data fields for the north, south, east, west values respectively.
    • west

      private int west
      Data fields for the north, south, east, west values respectively.
    • id

      private int id
      A unique identifier for the GamePiece
  • Constructor Details

    • GamePiece

      public GamePiece()
      Construct a GamePiece object with random values.
  • Method Details

    • getNorth

      public int getNorth()
      Gets the north value of the GamePiece.
      Returns:
      the north value.
    • setNorth

      public void setNorth(int north)
      Sets the north value of the GamePiece.
      Parameters:
      north - the new value.
    • getSouth

      public int getSouth()
      Gets the south value of the GamePiece.
      Returns:
      the south value.
    • setSouth

      public void setSouth(int south)
      Sets the south value of the GamePiece.
      Parameters:
      south - the new value.
    • getEast

      public int getEast()
      Gets the east value of the GamePiece.
      Returns:
      the east value.
    • setEast

      public void setEast(int east)
      Sets the east value of the GamePiece.
      Parameters:
      east - the new value.
    • getWest

      public int getWest()
      Gets the west value of the GamePiece.
      Returns:
      the west value.
    • setWest

      public void setWest(int west)
      Sets the west value of the GamePiece.
      Parameters:
      west - the new value.
    • getId

      public int getId()
      Get the id number of the GamePiece
      Returns:
      the unique id number