import java.awt.Color;
public class Bod {
private int x;
private int y;
private boolean visible;
private Color farba;
private int velkostBodu;
public Bod() {
super();
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
public Color getFarba() {
return farba;
}
public void setFarba(Color farba) {
this.farba = farba;
}
public int getVelkostBodu() {
return velkostBodu;
}
public void setVelkostBodu(int velkostBodu) {
this.velkostBodu = velkostBodu;
}
public Bod(int x, int y) {
super();
this.x = x;
this.y = y;
}
public Bod(int x, int y, boolean visible, Color farba, int velkostBodu) {
super();
this.x = x;
this.y = y;
this.visible = visible;
this.farba = farba;
this.velkostBodu = velkostBodu;
}
public double vzdialenostKBodu(Bod b) {
return Math.sqrt(Math.pow(this.x - b.getX(), 2)
+ Math.pow((this.y - b.getY()), 2));
}
public boolean rovnakeSuradnice(Bod bod) {
return ((bod.getX() == this.getX()) && (bod.getY() == this.getY()));
}
public void posunO(double dx, double dy) {
int novex = this.x + (int) dx;
int novey = this.y + (int) dy;
this.setX(novex);
this.setY(novey);
}
public Bod posunutyBod(double dx, double dy) {
Bod b = new Bod(this.x, this.y, this.visible, this.farba, this.velkostBodu);
b.posunO(dx, dy);
return b;
}
@Override
public String toString() {
return "[x=" + this.x + "; y=" + this.y + "; velkost="
+ this.velkostBodu + "; farba=" + this.farba + "]";
}
}