Advertisement
Guest User

TolinService

a guest
Sep 16th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. public List<Golub> findAllFinalMode() {
  2. final List<Golub> res = new ArrayList<Golub>();
  3.  
  4. for (final Golub c : this.findAll())
  5. if (c.getFinalMode())
  6. res.add(c);
  7.  
  8. return res;
  9. }
  10.  
  11. public List<Golub> findAllNoFinalMode() {
  12. final List<Golub> res = new ArrayList<Golub>();
  13.  
  14. for (final Golub c : this.findAll())
  15. if (c.getFinalMode() == false)
  16. res.add(c);
  17.  
  18. return res;
  19. }
  20.  
  21. public Map<String, Double> computeGolubsPerConferenceStats() {
  22. Map<String, Double> result;
  23. result = new HashMap<String, Double>();
  24. Double[] stats;
  25.  
  26. if (!this.findAllFinalMode().isEmpty()) {
  27. stats = this.golubRepository.getGolubsPerConferenceStats();
  28. result.put("avg", stats[0]);
  29. result.put("stdev", stats[1]);
  30. } else {
  31. result.put("avg", 0.0);
  32. result.put("stdev", 0.0);
  33. }
  34.  
  35. return result;
  36. }
  37.  
  38. public Map<String, Double> ratioPublishedVersusTotalGolubs() {
  39. Map<String, Double> result;
  40. result = new HashMap<String, Double>();
  41. final Double publishedGolubs = (double) this.findAllFinalMode().size();
  42. final Double total = (double) this.findAll().size();
  43. final Double ratio = publishedGolubs / total;
  44.  
  45. if (!this.findAll().isEmpty())
  46. result.put("ratio", ratio);
  47. else
  48. result.put("ratio", 0.0);
  49.  
  50. return result;
  51. }
  52. public Map<String, Double> ratioUnpublishedVersusTotalGolubs() {
  53. Map<String, Double> result;
  54. result = new HashMap<String, Double>();
  55. final Double unpublishedGolubs = (double) this.findAllNoFinalMode().size();
  56. final Double total = (double) this.findAll().size();
  57. final Double ratio = unpublishedGolubs / total;
  58.  
  59. if (!this.findAll().isEmpty())
  60. result.put("ratio", ratio);
  61. else
  62. result.put("ratio", 0.0);
  63.  
  64. return result;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement