-
Notifications
You must be signed in to change notification settings - Fork 2
/
Game.pde
59 lines (47 loc) · 1.24 KB
/
Game.pde
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
public class Game {
private int id;
private String date;
private Team homeTeam;
private Team visitorTeam;
private int homeScore;
private int visitorScore;
public Game(int id, String date, Team homeTeam, Team visitorTeam, int homeScore, int visitorScore) {
this.id = id;
this.date = date;
this.homeTeam = homeTeam;
this.visitorTeam = visitorTeam;
this.homeScore = homeScore;
this.visitorScore = visitorScore;
}
public int getId() {
return this.id;
}
public String getDate() {
return this.date;
}
public Team getHomeTeam() {
return this.homeTeam;
}
public Team getVisitorTeam() {
return this.visitorTeam;
}
public Team getWinner() {
if(this.homeScore > this.visitorScore)
return this.homeTeam;
else if(this.homeScore < this.visitorScore)
return this.visitorTeam;
return null;
}
public int getHomeScore() {
return this.homeScore;
}
public int getVisitorScore() {
return this.visitorScore;
}
public ArrayList<GameEvent> getEvents() {
return new FileLoader().loadGameEvents(this.id);
}
public float[][] getAverageSpeed(Player player) {
return new FileLoader().getAverageSpeed(this.id, player.getId());
}
}