2021-03-23 10:37:51 +01:00
|
|
|
package battleship.model;
|
|
|
|
|
2021-03-27 13:12:33 +01:00
|
|
|
import battleship.utils.*;
|
2021-03-23 10:37:51 +01:00
|
|
|
|
|
|
|
public class Ship {
|
|
|
|
|
2021-03-27 13:12:33 +01:00
|
|
|
private final Pair<Integer, Integer> coords;
|
|
|
|
private final int size;
|
|
|
|
private final Pair<Integer,Integer> direction;
|
|
|
|
// (0,-1) bas // (0,1) haut // (1,0) droite // (-1,0) gauche
|
|
|
|
private Boolean isDrown;
|
2021-03-23 10:37:51 +01:00
|
|
|
|
2021-03-27 13:12:33 +01:00
|
|
|
public Ship(Pair<Integer, Integer> coords, int size,Pair<Integer,Integer> direction) {
|
2021-03-23 10:37:51 +01:00
|
|
|
this.coords = coords;
|
|
|
|
this.size = size;
|
2021-03-27 13:12:33 +01:00
|
|
|
this.direction = direction;
|
|
|
|
this.isDrown = Boolean.FALSE;
|
|
|
|
}
|
|
|
|
public void isDrown(){
|
|
|
|
isDrown = Boolean.TRUE;
|
|
|
|
}
|
|
|
|
public Boolean hasDrown(){
|
|
|
|
return isDrown;
|
|
|
|
}
|
|
|
|
public int getSize(){
|
|
|
|
return this.size;
|
|
|
|
}
|
|
|
|
public Pair<Integer, Integer> getDirection(){
|
|
|
|
return this.direction;
|
|
|
|
}
|
|
|
|
public Pair<Integer,Integer> getCoords(){
|
|
|
|
return this.coords;
|
2021-03-23 10:37:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|