コード例 #1
0
 public Streak getAssociatedStreak(Team t) {
   if (runningTeams.contains(t)) {
     for (Streak st : streaks) {
       if (st.getTeam().equals(t) && st.isActive()) return st;
     }
   }
   return new Streak();
 }
コード例 #2
0
  public void generateStreaks() {
    for (Team t : runningTeams) {
      boolean toCreate = true;
      for (Streak st : streaks) {

        if (st.getTeam().equals(t) && st.isActive()) {
          toCreate = false;
        }
      }
      if (toCreate) {
        Timestamp time = getLastGamePlayed().getTimestamp();
        if (streaks.size() == 0) { // if there are no active streaks and season begins
          time = new Timestamp(0);
        }
        Streak s = new Streak(streakLength, initialSum, t, time);
        streaks.add(s);
      }
    }
    for (Streak st : streaks) {
      if (st.calcGamesBettedOn() >= streakLength && st.isActive()) {
        disableStreak(st);
      }
    }
  }
コード例 #3
0
 public void disableStreak(Streak st) {
   st.setActive(false);
   runningTeams.remove(st.getTeam());
 }