Class Point


  • public final class Point
    extends java.lang.Object
    An immutable point in 2D space, with x and y coordinates.
    • Constructor Summary

      Constructors 
      Constructor Description
      Point​(int x, int y)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int getX()  
      int getY()  
      int hashCode()  
      @NotNull Point plus​(@NotNull Point point)
      Returns a new point as a result of summing point coordinates to the current ones.
      java.lang.String toString()  
      @NotNull Point translate​(int x, int y)
      Returns a new point translated by x and y.
      • Methods inherited from class java.lang.Object

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

      • Point

        public Point​(int x,
                     int y)
    • Method Detail

      • getX

        public int getX()
      • getY

        public int getY()
      • translate

        @NotNull
        public @NotNull Point translate​(int x,
                                        int y)
        Returns a new point translated by x and y.
      • plus

        @NotNull
        public @NotNull Point plus​(@NotNull
                                   @NotNull Point point)
        Returns a new point as a result of summing point coordinates to the current ones.
      • toString

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object