Package shapes
Class Point
- java.lang.Object
-
- shapes.Shape
-
- shapes.Point
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Shape>
,Movable
public class Point extends Shape
Class that represent point shape.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
private int
xCoordinate
private int
yCoordinate
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Point
clone()
Create new instance of this point.int
compareTo(Shape shape)
Compare two points depend on their distance.boolean
containsClick(int xCoordinate, int yCoordinate)
Determine if this point contains user click.double
distance(Point point)
Calculate dinstance between two points.void
draw(java.awt.Graphics graphics)
Draw point.boolean
equals(java.lang.Object obj)
Determine if two points are equal depends on their coordinates.int
getXcoordinate()
int
getYcoordinate()
void
moveTo(int xCoordinate, int yCoordinate)
Move point to forwarded coordinates.void
selected(java.awt.Graphics graphics)
Select point.void
setXcoordinate(int xCoordinate)
void
setYcoordinate(int yCoordinate)
java.lang.String
toString()
Print point values.-
Methods inherited from class shapes.Shape
getColor, isSelected, setColor, setSelected
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
xCoordinate
private int xCoordinate
-
yCoordinate
private int yCoordinate
-
-
Method Detail
-
draw
public void draw(java.awt.Graphics graphics)
Draw point.
-
equals
public boolean equals(java.lang.Object obj)
Determine if two points are equal depends on their coordinates.- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(Shape shape)
Compare two points depend on their distance.
-
toString
public java.lang.String toString()
Print point values.- Overrides:
toString
in classjava.lang.Object
- Returns:
-
moveTo
public void moveTo(int xCoordinate, int yCoordinate)
Move point to forwarded coordinates.- Parameters:
xCoordinate
- Represent x coordinate where to moveyCoordinate
- Represent y coordinate where to move.
-
selected
public void selected(java.awt.Graphics graphics)
Select point.
-
containsClick
public boolean containsClick(int xCoordinate, int yCoordinate)
Determine if this point contains user click.- Specified by:
containsClick
in classShape
- Parameters:
xCoordinate
- Represent x coordinate of user click.yCoordinate
- Represent y coordinate of user click.- Returns:
- Boolean indicating if this point contain user click.
-
clone
public Point clone()
Create new instance of this point.- Overrides:
clone
in classjava.lang.Object
-
distance
public double distance(Point point)
Calculate dinstance between two points.- Parameters:
point
- Point in relation to which the distance is calculated- Returns:
- Distance between two points.
-
getXcoordinate
public int getXcoordinate()
-
setXcoordinate
public void setXcoordinate(int xCoordinate)
-
getYcoordinate
public int getYcoordinate()
-
setYcoordinate
public void setYcoordinate(int yCoordinate)
-
-