Exemplo n.º 1
0
 public int calcActiveStreaks() {
   int i = 0;
   for (Streak st : streaks) {
     if (st.isActive()) i++;
   }
   return i;
 }
Exemplo n.º 2
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();
 }
Exemplo n.º 3
0
  public void betPlaced(Team t) {
    Streak lastStreak = getAssociatedStreak(t);
    if (!lastStreak.isDefault()) {
      double nextSum = lastStreak.getCurrentSum() * 2;
      switch ((int) lastStreak.getCurrentSum()) {
        case 10:
          nextSum = 25;
          break;
        case 25:
          nextSum = 47.5;
          break;
        case 47:
          nextSum = 76;
          break;
        case 76:
          nextSum = 117.8;
          break;
        case 117:
          nextSum = 139;
          break;
        case 0:
          nextSum = 10;
          break;
      }
      /*if(lastStreak.calcGamesBettedOn()>=1) {
      	nextSum = lastStreak.getCurrentSum() + lastStreak.getLastBet().getDrawPlaced();
      }*/
      lastStreak.placeDraw(lastStreak.getNextGame(), lastStreak.getCurrentSum());

      lastStreak.setCurrentSum(nextSum);
    }
  }
Exemplo n.º 4
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);
      }
    }
  }
Exemplo n.º 5
0
 public boolean activeStreakExists() {
   for (Streak st : streaks) {
     if (st.isActive()) return true;
   }
   return false;
 }
Exemplo n.º 6
0
 public void disableStreak(Streak st) {
   st.setActive(false);
   runningTeams.remove(st.getTeam());
 }