-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTeam.pde
52 lines (40 loc) · 1.13 KB
/
Team.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
public class Team {
private final static String teamPrefix = "images/teams/";
private final static String teamSufix = ".gif";
private int id;
private String name;
private String abbreviation;
private HashMap<Integer, Player> players;
private PImage logo;
public Team(int id, String name, String abbreviation, Player[] players) {
this.id = id;
this.name = name;
this.abbreviation = abbreviation;
this.logo = loadImage(teamPrefix + this.id + teamSufix);
this.players = new HashMap<Integer, Player>(10);
for(Player p : players)
this.players.put(p.getId(), p);
}
public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
public String getAbbreviation() {
return this.abbreviation;
}
public PImage getLogo() {
return this.logo;
}
public int[] getGamesWinsLosses() {
return new FileLoader().getGamesWinsLosses(this.id);
}
public Player[] getPlayers() {
Player[] r = new Player[players.size()];
int i = 0;
for(int pId : players.keySet())
r[i++] = players.get(pId);
return r;
}
}