Class Coord


  • public class Coord
    extends java.lang.Object
    Coord is a coordinate with x and y values.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int x
      x position
      int y
      y position
    • Constructor Summary

      Constructors 
      Constructor Description
      Coord()
      Constructs a coordinate with x = y = 0.
      Coord​(int x, int y)
      Constructs a coordinate with the given x, y.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)
      Returns true if the coordinates of this Coord and the given one are the same
      int hashCode()
      Returns the hashcode: x<<16 | y
      int height()
      return's y.
      java.lang.String toString()  
      void translate​(int dx, int dy)
      Translates the current coordinate making x += dx and y += dy
      int width()
      return's x.
      • Methods inherited from class java.lang.Object

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

      • x

        public int x
        x position
      • y

        public int y
        y position
    • Constructor Detail

      • Coord

        public Coord()
        Constructs a coordinate with x = y = 0.
      • Coord

        public Coord​(int x,
                     int y)
        Constructs a coordinate with the given x, y.
    • Method Detail

      • translate

        public void translate​(int dx,
                              int dy)
        Translates the current coordinate making x += dx and y += dy
      • width

        public int width()
        return's x. just to make sense in getSize like methods
      • height

        public int height()
        return's y. just to make sense in getSize like methods
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Returns true if the coordinates of this Coord and the given one are the same
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Returns the hashcode: x<<16 | y
        Overrides:
        hashCode in class java.lang.Object