Class Point ok
This commit is contained in:
parent
5b85b9adec
commit
743328301d
@ -1,5 +1,11 @@
|
|||||||
package TD1.point;
|
package TD1.point;
|
||||||
|
|
||||||
|
/********************************************************************************************
|
||||||
|
* @author JunkJumper *
|
||||||
|
* @license https://creativecommons.org/licenses/by/4.0/ License CC BY 4.0 *
|
||||||
|
* @since File available since 20/05/2020 *
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
public class MainTestPoint {
|
public class MainTestPoint {
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
@ -103,6 +109,7 @@ public class MainTestPoint {
|
|||||||
System.out.println("C3 : " + C3.toString());
|
System.out.println("C3 : " + C3.toString());
|
||||||
System.out.println("O3 : " + O3.toString());
|
System.out.println("O3 : " + O3.toString());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
package TD1.point;
|
package TD1.point;
|
||||||
|
|
||||||
|
/********************************************************************************************
|
||||||
|
* @author JunkJumper *
|
||||||
|
* @license https://creativecommons.org/licenses/by/4.0/ License CC BY 4.0 *
|
||||||
|
* @since File available since 20/05/2020 *
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
public class Point
|
public class Point
|
||||||
{
|
{
|
||||||
private double x;
|
private double x;
|
||||||
@ -43,23 +49,15 @@ public class Point
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
Point p = (Point)obj;
|
Point p = (Point)obj;
|
||||||
if (this.x == p.x && this.y == p.y) {
|
return (this.x == p.x && this.y == p.y);
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point clone() {
|
public Point clone() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayLocation() {
|
public String displayLocation() {
|
||||||
System.out.println("x = " + this.getX() + " , y = " + this.getY() + ".");
|
return "x = " + this.getX() + " , y = " + this.getY();
|
||||||
}
|
|
||||||
|
|
||||||
public Point getLocation() {
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocation(Point p) {
|
public void setLocation(Point p) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user