-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShip.java
More file actions
59 lines (49 loc) · 1.09 KB
/
Ship.java
File metadata and controls
59 lines (49 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package cs3500.pa03.Model;
import java.util.List;
/**
* Represents a ship.
*/
public class Ship {
private ShipType type;
private List<Coord> points;
private DirectionType direction;
private int shipLength;
private Coord firstCoord;
public Ship(ShipType type, List<Coord> points, DirectionType direction, Coord firstCoord) {
this.type = type;
this.points = points;
this.direction = direction;
this.shipLength = type.getLength();
this.firstCoord = firstCoord;
}
/**
* @return the type of a ship
*/
public ShipType getShipType() {
return type;
}
/**
* @return the coordinates of each ship
*/
public List<Coord> getPoints() {
return points;
}
/**
* @return the coordinate of the first ship
*/
public Coord getFirstCoord() {
return firstCoord;
}
/**
* @return the direction of a ship
*/
public DirectionType getDirection() {
return direction;
}
/**
* @return the length of a ship
*/
public int getShipLength() {
return shipLength;
}
}