Round.java 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package analyzer.models;
  2. import java.util.HashMap;
  3. import java.util.Hashtable;
  4. import java.util.Map;
  5. public class Round {
  6. private final int no;
  7. private Map<Hashtag, Integer> hashtagMap;
  8. private Map<User, Integer> userMap;
  9. public Round(int no) {
  10. this.no = no;
  11. hashtagMap = new Hashtable<>();
  12. userMap = new Hashtable<>();
  13. }
  14. public int getNo() {
  15. return no;
  16. }
  17. public void addHashtag(Hashtag hashtag) {
  18. Integer value = this.hashtagMap.get(hashtag);
  19. if (value != null)
  20. this.hashtagMap.replace(hashtag, value + 1);
  21. else
  22. this.hashtagMap.put(hashtag, 1);
  23. }
  24. public void addUser(User user) {
  25. Integer value = this.userMap.get(user);
  26. if (value != null)
  27. this.userMap.replace(user, value + 1);
  28. else
  29. this.userMap.put(user, 1);
  30. }
  31. public Map<Hashtag, Integer> getHashtags() {
  32. return hashtagMap;
  33. }
  34. public Map<User, Integer> getUserMap() {
  35. return this.userMap;
  36. }
  37. }