Class Point

java.lang.Object
com.github.ngoanh2n.Point

@CanIgnoreReturnValue @ParametersAreNonnullByDefault public class Point extends Object
A copy of java.awt.Point.

Repository:
Since:
2021
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a new Point at 0:0 of the coordinate.
    Point(int x, int y)
    Construct a new Point by x:y of the coordinate.
    Point(Point other)
    Construct a new Point by other Point.
  • Method Summary

    Modifier and Type
    Method
    Description
    decX(int value)
    Decrease X coordinate for this Point by value.
    decY(int value)
    Decrease Y coordinate for this Point by value.
    boolean
    equals(Point other)
    Check whether the current Point equals to other Point.
    int
    Get the X coordinate of this Point.
    int
    Get the Y coordinate of this Point.
    incX(int value)
    Increase X coordinate for this Point by value.
    incY(int value)
    Increase Y coordinate for this Point by value.
    boolean
    Check whether the current Point at 0:0 of the coordinate.
    setX(int x)
    Set X coordinate for this Point.
    setY(int y)
    Set Y coordinate for this Point.
    Returns a string representation of this Point.

    Methods inherited from class java.lang.Object

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

    • Point

      public Point()
      Construct a new Point at 0:0 of the coordinate.
    • Point

      public Point(int x, int y)
      Construct a new Point by x:y of the coordinate.
      Parameters:
      x - The X coordinate of the newly constructed Point.
      y - The Y coordinate of the newly constructed Point.
    • Point

      public Point(Point other)
      Construct a new Point by other Point.
      Parameters:
      other - The source Point.
  • Method Details

    • getX

      public int getX()
      Get the X coordinate of this Point.
      Returns:
      The X coordinate of this Point.
    • setX

      public Point setX(int x)
      Set X coordinate for this Point.
      Parameters:
      x - The new X coordinate for this Point.
      Returns:
      This Point.
    • getY

      public int getY()
      Get the Y coordinate of this Point.
      Returns:
      The Y coordinate of this Point.
    • setY

      public Point setY(int y)
      Set Y coordinate for this Point.
      Parameters:
      y - The new X coordinate for this Point.
      Returns:
      This Point.
    • incX

      public Point incX(int value)
      Increase X coordinate for this Point by value.
      Parameters:
      value - The value to be added to X coordinate of this Point.
      Returns:
      This Point.
    • decX

      public Point decX(int value)
      Decrease X coordinate for this Point by value.
      Parameters:
      value - The value to be subtracted to X coordinate of this Point.
      Returns:
      This Point.
    • incY

      public Point incY(int value)
      Increase Y coordinate for this Point by value.
      Parameters:
      value - The value to be added to Y coordinate of this Point.
      Returns:
      This Point.
    • decY

      public Point decY(int value)
      Decrease Y coordinate for this Point by value.
      Parameters:
      value - The value to be subtracted to Y coordinate of this Point.
      Returns:
      This Point.
    • isOrigin

      public boolean isOrigin()
      Check whether the current Point at 0:0 of the coordinate.
      Returns:
      true if the current Point at 0:0 of the coordinate; false otherwise.
    • equals

      public boolean equals(Point other)
      Check whether the current Point equals to other Point.
      Parameters:
      other - Point to be compared.
      Returns:
      true if the current Point equals to other Point; false otherwise.
    • toString

      public String toString()
      Returns a string representation of this Point.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this Point.