Class Coordinate


  • public class Coordinate
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int X
      The X coordinate.
      int Y
      The Y coordinate.
    • Constructor Summary

      Constructors 
      Constructor Description
      Coordinate()
      Constructs a new Coordinate initialized as the origin (0, 0).
      Coordinate​(int x, int y)
      Constructs a new Coordinate with the specified values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Tests another object for equality with this instance.
      int hashCode()
      Return a hash code value for this Coordinate.
      java.lang.String toString()
      Returns a string representation of the Coordinate in the form "(X, Y)".
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • X

        public int X
        The X coordinate.
      • Y

        public int Y
        The Y coordinate.
    • Constructor Detail

      • Coordinate

        public Coordinate()
        Constructs a new Coordinate initialized as the origin (0, 0).
      • Coordinate

        public Coordinate​(int x,
                          int y)
        Constructs a new Coordinate with the specified values.
        Parameters:
        x - the X coordinate.
        y - the Y coordinate.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Tests another object for equality with this instance.
        Overrides:
        equals in class java.lang.Object
        Returns:
        whether it is equal or not.
      • hashCode

        public int hashCode()
        Return a hash code value for this Coordinate. This method returns the bitwise and of the X and Y integer values.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A hash code value for this Coordinate
      • toString

        public java.lang.String toString()
        Returns a string representation of the Coordinate in the form "(X, Y)".
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the Coordinates.