-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathImplMatch.java
More file actions
51 lines (48 loc) · 1.64 KB
/
ImplMatch.java
File metadata and controls
51 lines (48 loc) · 1.64 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
import java.util.*;
// Implementing the remote interface
public class ImplMatch implements UtilsClass {
Map<Integer,Match> map=new HashMap<Integer,Match>();
int numMatches = 0;// keep track of number of matches
// Implementing the interface method
public int AddMatch(int v,String players, boolean update, String db_addr){
// add this to database
map.put(numMatches, new Match(v,players, update, db_addr));
return numMatches++;
}
public void LoadMatch(int matchId) {
Match match = map.get(matchId);
match.LoadMatch(matchId);
}
public void UpdatePlayerScore(int matchId, int playerId, int score, boolean update){
Match match = map.get(matchId);
match.UpdatePlayerScore(playerId,score, update);
}
public int UserCreateTeam(int matchId, int[] playerIds, boolean update){
Match match = map.get(matchId);
return match.addTeam( playerIds, update);
}
public int GetScore(int matchId, int userId){
Match match = map.get(matchId);
return match.getUserScore(userId);
}
public int GetRank(int matchId, int userId){
Match match = map.get(matchId);
return match.getUserRank(userId);
}
public String GetLeaderBoard(int matchId){
Match match = map.get(matchId);
return match.getLeaderBoard();
}
public void startMatch(int matchId){
Match match = map.get(matchId);
match.startMatch();
}
public String ShowPlayers(int matchId){
Match match = map.get(matchId);
return match.showPlayers();
}
public void DeleteMatch(int matchId) {
Match match = map.get(matchId);
match.DeleteMatch();
}
}