package sk.upjs.test;
import java.awt.Color;
import java.awt.geom.Point2D;
public class FarebnyBod extends Point2D {
private double x;
private double y;
private Color farba;
@Override
public double getX() {
return x;
}
@Override
public double getY() {
return y;
}
public Color getFarba(){
return this.farba;
}
@Override
public void setLocation(double x, double y) {
this.x = x;
this.y = y;
}
public void setFarba(Color farba) {
this.farba = farba;
}
public boolean equals(FarebnyBod farebny){
return ( (farebny.getX()== this.x)&& (farebny.getY()== this.y)&& (farebny.getFarba().equals(this.farba)));
}
public FarebnyBod(double x, double y, Color farba) {
this.setLocation(x,y);
this.setFarba(farba);
}
public FarebnyBod(double x, double y) {
this.setLocation(x,y);
int a=(int)(Math.random()*3);
if (a==0) {
this.setFarba(Color.RED);
}
else if (a==1) {
this.setFarba(Color.GREEN);
}
else {
this.setFarba(Color.BLUE);
}
}
}