Class Position

java.lang.Object
rea.components.Position

public class Position extends Object
A position in the game map. Provides the x and y coordinates of the position. to the Positionable components.
Author:
José Paulo Leal jpleal@fc.up.pt
  • Constructor Summary

    Constructors
    Constructor
    Description
    Position(int x, int y)
    Create a position with the given coordinates.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the x coordinate of the position.
    int
    Get the y coordinate of the position.
    Show the position as a pair, within round brackets.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Position

      public Position(int x, int y)
      Create a position with the given coordinates.
      Parameters:
      x - coordinate
      y - coordinate
  • Method Details

    • getX

      public int getX()
      Get the x coordinate of the position.
      Returns:
      x coordinate
    • getY

      public int getY()
      Get the y coordinate of the position.
      Returns:
      y coordinate
    • toString

      public String toString()
      Show the position as a pair, within round brackets.
      Overrides:
      toString in class Object
      Returns:
      string representation.