Ejemplo n.º 1
0
 public boolean isStrongWilledVictory() {
   Goal goal = match.getScore().getGoalByIndex(1);
   if (goal == null) {
     return false;
   }
   return goal.getWhoScored() == TeamLocation.GUEST
       ? match.getFulltimeResults() == Results.HOME
       : match.getFulltimeResults() == Results.GUEST;
 }
Ejemplo n.º 2
0
 public boolean isFirstGoalTillMinute(int minute) {
   Goal goal = match.getScore().getGoalByIndex(1);
   if (goal == null) {
     return false;
   }
   return (goal.getMinute() + (20 * (goal.getPeriod() - 1))) < minute;
 }
Ejemplo n.º 3
0
 public int getTeamMatchTotal(TeamLocation teamLocation) {
   if (teamLocation == TeamLocation.ANY) {
     throw new RuntimeException("lol");
   }
   int fulltimeHomeTotal = match.getScore().getFulltimeHomeTotal();
   int fulltimeGuestTotal = match.getScore().getFulltimeGuestTotal();
   if (teamLocation == TeamLocation.HOME) {
     return fulltimeHomeTotal;
   } else if (teamLocation == TeamLocation.GUEST) {
     return fulltimeGuestTotal;
   } else if (match.getFavoriteInfo().getFavorite() == Favorite.NONE) {
     throw new RuntimeException("lol");
   } else if (teamLocation == TeamLocation.FAVORITE) {
     return isFavoriteHome() ? fulltimeHomeTotal : fulltimeGuestTotal;
   } else if (teamLocation == TeamLocation.NOTFAVORITE) {
     return isFavoriteHome() ? fulltimeGuestTotal : fulltimeHomeTotal;
   }
   throw new RuntimeException("lol");
 }
Ejemplo n.º 4
0
 private boolean isTeamWinInFulltime(TeamLocation teamLocation) {
   if (teamLocation == TeamLocation.ANY) {
     throw new RuntimeException("lol");
   }
   Results fulltimeResults = match.getFulltimeResults();
   if (teamLocation == TeamLocation.HOME || teamLocation == TeamLocation.GUEST) {
     return teamLocation.equals(fulltimeResults);
   }
   if (teamLocation == TeamLocation.FAVORITE) {
     return isFavoriteHome() ? fulltimeResults == Results.HOME : fulltimeResults == Results.GUEST;
   }
   if (teamLocation == TeamLocation.NOTFAVORITE) {
     return isFavoriteHome() ? fulltimeResults == Results.GUEST : fulltimeResults == Results.HOME;
   }
   throw new RuntimeException("lol");
 }
Ejemplo n.º 5
0
 public boolean isScoredFirstGoal(TeamLocation teamLocation) {
   TeamLocation whoScoredFirstGoal = match.getScore().whoScoredFirstGoal();
   if (whoScoredFirstGoal == null) {
     return false;
   }
   if (teamLocation == TeamLocation.ANY) {
     return true;
   } else if (teamLocation == TeamLocation.HOME || teamLocation == TeamLocation.GUEST) {
     return teamLocation.equals(whoScoredFirstGoal);
   } else if (teamLocation == TeamLocation.FAVORITE) {
     return isFavoriteHome()
         ? whoScoredFirstGoal == TeamLocation.HOME
         : whoScoredFirstGoal == TeamLocation.GUEST;
   } else if (teamLocation == TeamLocation.NOTFAVORITE) {
     return isFavoriteHome()
         ? whoScoredFirstGoal == TeamLocation.GUEST
         : whoScoredFirstGoal == TeamLocation.HOME;
   } else {
     throw new RuntimeException("lol");
   }
 }
Ejemplo n.º 6
0
 public boolean isTeamScoredNGoalsInPeriod(TeamLocation teamLocation, int period, Double total) {
   if (teamLocation == TeamLocation.ANY) {
     throw new RuntimeException("lol");
   }
   Period periodByNumber = getPeriodByNumber(period);
   int homeTotal = periodByNumber.getHomeTotal();
   int guestTotal = periodByNumber.getGuestTotal();
   int teamTotalInPeriod;
   if (teamLocation == TeamLocation.HOME) {
     teamTotalInPeriod = homeTotal;
   } else if (teamLocation == TeamLocation.GUEST) {
     teamTotalInPeriod = guestTotal;
   } else if (match.getFavoriteInfo().getFavorite() == Favorite.NONE) {
     throw new RuntimeException("lol");
   } else if (teamLocation == TeamLocation.FAVORITE) {
     teamTotalInPeriod = isFavoriteHome() ? homeTotal : guestTotal;
   } else if (teamLocation == TeamLocation.NOTFAVORITE) {
     teamTotalInPeriod = isFavoriteHome() ? guestTotal : homeTotal;
   } else {
     throw new RuntimeException("lol");
   }
   return teamTotalInPeriod >= total;
 }
Ejemplo n.º 7
0
 public boolean areBothTeamScored() {
   return match.getScore().areBothTeamScored();
 }
Ejemplo n.º 8
0
 public boolean isAnyTeamWinWithDifference(int difference) {
   int fulltimeGuestTotal = match.getScore().getFulltimeGuestTotal();
   int fulltimeHomeTotal = match.getScore().getFulltimeHomeTotal();
   return Math.abs(fulltimeGuestTotal - fulltimeHomeTotal) == difference;
 }
Ejemplo n.º 9
0
 public boolean areBothTeamScoredInEachPeriod() {
   return match.getScore().areBothTeamScoredInEachPeriod();
 }
Ejemplo n.º 10
0
 private TeamLocation getTeamLocationByTeam(Team team) {
   return match.getTeamLocationByTeam(team);
 }
Ejemplo n.º 11
0
 public int getGuestTotal() {
   return match.getScore().getFulltimeGuestTotal();
 }
Ejemplo n.º 12
0
 public Period getPeriodByNumber(int period) {
   return match.getScore().getPeriodByNumber(period);
 }
Ejemplo n.º 13
0
 public int getHomeTotal() {
   return match.getScore().getFulltimeHomeTotal();
 }
Ejemplo n.º 14
0
 public int getGeneralTotal() {
   return match.getScore().getFulltimeGeneralTotal();
 }
Ejemplo n.º 15
0
 private boolean isFavoriteHome() {
   return match.getFavoriteInfo().getFavorite() == Favorite.HOME;
 }