?? olympicgames.java
字號:
package games;
import java.util.*;
public class OlympicGames {
private Map competitions = new HashMap();
public void addCompetition(String name, String venue) {
competitions.put(name, new Competition(name, venue));
}
public String getVenue(String competition) throws NoSuchCompetition {
Competition c = (Competition)competitions.get(competition);
if(c == null)
throw new NoSuchCompetition();
return c.getVenue();
}
public void addAthlete(String competition, String name, int number, String country) {
Competition c = (Competition)competitions.get(competition);
if(c == null)
return;
c.addAthlete(name, number, country);
}
public String getName(String competition, int number) {
Competition c = (Competition)competitions.get(competition);
if(c == null)
return "";
return c.getName(number);
}
public void setTime(String competition, int athlete, int seconds) {
Competition c = (Competition)competitions.get(competition);
if(c == null)
return;
c.setTime(athlete, seconds);
}
public String getOrder(String competition) {
Competition c = (Competition)competitions.get(competition);
if(c == null)
return "";
return c.getOrder();
}
public int count(String athlete) {
int count = 0;
for(Iterator i = competitions.values().iterator(); i.hasNext();){
Competition c = (Competition)i.next();
if(c.contains(athlete))
++count;
}
return count;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -