-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObstacleData.java
36 lines (31 loc) · 978 Bytes
/
ObstacleData.java
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
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@XmlRootElement(name = "obstacle")
public class ObstacleData
{
@XmlElement
public Point position; // Position refers to it's position relative to the threshold
@XmlElement
public int maxHeight;
@XmlElement
public int distanceFromCentreLine;
private ObstacleData()
{
this.position = new Point();
}
public ObstacleData(Point position, int maxHeight, int distanceFromCentreLine) throws IllegalArgumentException
{
if (maxHeight < 0) {
throw new IllegalArgumentException("Can't create obstacle with negative height");
}
this.position = position;
this.maxHeight = maxHeight;
this.distanceFromCentreLine = distanceFromCentreLine;
}
public String getName()
{
return "Max Height: " + this.maxHeight;
}
}