View Javadoc

1   package at.meikel.dmrl.server.model;
2   
3   import java.util.List;
4   import java.util.Vector;
5   
6   public class Rangliste {
7   
8       private Vector<Player> eintraege = new Vector<Player>();
9   
10      public void addSpieler(Player spieler) {
11          eintraege.add(spieler);
12      }
13  
14      public int size() {
15          return eintraege.size();
16      }
17  
18      public List<Player> getAllPlayers() {
19          return new Vector<Player>(eintraege);
20      }
21  
22      public List<Player> find(String verein) {
23          if (verein != null) {
24              verein = verein.toLowerCase();
25          }
26          Vector<Player> result = new Vector<Player>();
27          for (Player spieler : eintraege) {
28              if ((verein == null) || (spieler.getVerein() == null) || (spieler.getVerein().toLowerCase().contains(verein))) {
29                  result.add(spieler);
30              }
31          }
32          return result;
33      }
34  
35      public List<Player> findByNationalAssociation(String nationalAssociation) {
36          if (nationalAssociation != null) {
37              nationalAssociation = nationalAssociation.toLowerCase();
38          }
39          Vector<Player> result = new Vector<Player>();
40          for (Player spieler : eintraege) {
41              if ((nationalAssociation == null) || (spieler.getVerein() == null) || (spieler.getLandesverband().toLowerCase().equals(nationalAssociation))) {
42                  result.add(spieler);
43              }
44          }
45          return result;
46      }
47  
48      public Player findByLicenseId(String licenseId) {
49          for (Player player : eintraege) {
50              if (player.getPassnummer().equals(licenseId)) {
51                  return player;
52              }
53          }
54          return null;
55      }
56  }