Package com.github.ngoanh2n
Class Point
java.lang.Object
com.github.ngoanh2n.Point
- Since:
- 2021
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecX
(int value) Decrease X coordinate for thisPoint
byvalue
.decY
(int value) Decrease Y coordinate for thisPoint
byvalue
.boolean
Check whether the currentPoint
equals to otherPoint
.int
getX()
Get the X coordinate of thisPoint
.int
getY()
Get the Y coordinate of thisPoint
.incX
(int value) Increase X coordinate for thisPoint
byvalue
.incY
(int value) Increase Y coordinate for thisPoint
byvalue
.boolean
isOrigin()
Check whether the currentPoint
at0:0
of the coordinate.setX
(int x) Set X coordinate for thisPoint
.setY
(int y) Set Y coordinate for thisPoint
.toString()
Returns a string representation of thisPoint
.
-
Constructor Details
-
Point
public Point()Construct a newPoint
at0:0
of the coordinate. -
Point
public Point(int x, int y) Construct a newPoint
byx:y
of the coordinate.- Parameters:
x
- The X coordinate of the newly constructedPoint
.y
- The Y coordinate of the newly constructedPoint
.
-
Point
- Parameters:
other
- The sourcePoint
.
-
-
Method Details
-
getX
public int getX()Get the X coordinate of thisPoint
.- Returns:
- The X coordinate of this
Point
.
-
setX
Set X coordinate for thisPoint
.- Parameters:
x
- The new X coordinate for thisPoint
.- Returns:
- This
Point
.
-
getY
public int getY()Get the Y coordinate of thisPoint
.- Returns:
- The Y coordinate of this
Point
.
-
setY
Set Y coordinate for thisPoint
.- Parameters:
y
- The new X coordinate for thisPoint
.- Returns:
- This
Point
.
-
incX
Increase X coordinate for thisPoint
byvalue
.- Parameters:
value
- The value to be added to X coordinate of thisPoint
.- Returns:
- This
Point
.
-
decX
Decrease X coordinate for thisPoint
byvalue
.- Parameters:
value
- The value to be subtracted to X coordinate of thisPoint
.- Returns:
- This
Point
.
-
incY
Increase Y coordinate for thisPoint
byvalue
.- Parameters:
value
- The value to be added to Y coordinate of thisPoint
.- Returns:
- This
Point
.
-
decY
Decrease Y coordinate for thisPoint
byvalue
.- Parameters:
value
- The value to be subtracted to Y coordinate of thisPoint
.- Returns:
- This
Point
.
-
isOrigin
public boolean isOrigin()Check whether the currentPoint
at0:0
of the coordinate.- Returns:
true
if the currentPoint
at0:0
of the coordinate;false
otherwise.
-
equals
Check whether the currentPoint
equals to otherPoint
.- Parameters:
other
-Point
to be compared.- Returns:
true
if the currentPoint
equals to otherPoint
;false
otherwise.
-
toString
Returns a string representation of thisPoint
.
-