Пример #1
0
  @Override
  public StadisticsTeam getMyStatistics(Team t) {
    StadisticsTeam res;

    if (t.equals(stadistics.getHome().getTeam())) {
      res = stadistics.getHome();
    } else {
      res = stadistics.getAway();
    }

    return res;
  }
Пример #2
0
  @Override
  public void playMatch() {
    calcShoots();

    AverageLocation loc;
    Integer teamShoots;
    StadisticsTeam teamShooter;
    StadisticsTeam teamKilled;

    Goals gs;
    Assistances as;
    Injuries ls;

    // Calculo de los tiros que han sido gol por cada equipo
    for (int t = 0; t < 2; t++) {
      if (t == 0) {
        loc = AverageLocation.HOME;
        teamShoots = shoots.get(POS_HOME);
        teamShooter = stadistics.getHome();
        teamKilled = stadistics.getAway();
      } else {
        loc = AverageLocation.AWAY;
        teamShoots = shoots.get(POS_AWAY);
        teamShooter = stadistics.getAway();
        teamKilled = stadistics.getHome();
      }

      gs = new GoalsImpl(this, teamShooter, teamKilled, loc);

      for (int s = 0; s < teamShoots; s++) {
        gs.calcGoal();
      }

      if (teamShooter.isPlayerTeam()) {
        // Asistencias
        as = new AssistancesImpl(teamShooter);

        for (Integer s = 0; s < getMyGoals(teamShooter.getTeam()); s++) {
          as.calcAssis(s);
        }

        // Lesiones
        ls = new InjuriesImpl(teamShooter);

        ls.calcInjuries();
      }
    }
  }
Пример #3
0
  @Override
  public boolean playingAtHome(Team t) {
    boolean res = false;

    if (t.equals(stadistics.getHome().getTeam())) {
      res = true;
    }

    return res;
  }
Пример #4
0
  @Override
  public AverageLocation getMyLocation(Team t) {
    AverageLocation res;

    if (t.equals(stadistics.getHome().getTeam())) {
      res = AverageLocation.HOME;
    } else {
      res = AverageLocation.AWAY;
    }

    return res;
  }
Пример #5
0
  @Override
  public Integer getMyGoalsConceded(Team t) {
    Integer res;

    if (t.equals(stadistics.getHome().getTeam())) {
      res = getGoalsAway();
    } else {
      res = getGoalsHome();
    }

    return res;
  }
Пример #6
0
  private void calcShoots() {
    Averages avHome = stadistics.getHome().getAverage();
    Averages avAway = stadistics.getAway().getAverage();

    Double relShootsHome =
        avHome.findAverage(AverageTypes.A_PLUS).getValue()
            - avAway.findAverage(AverageTypes.D_PLUS).getValue();
    Double relShootsAway =
        avAway.findAverage(AverageTypes.A_PLUS).getValue()
            - avHome.findAverage(AverageTypes.D_PLUS).getValue();

    shoots.add(calcShoots(relShootsHome));

    Integer shootsAway = calcShoots(relShootsAway);

    if (shootsAway > 1)
      /** < A los equipos en Away se les debe restar 1 tiro por estar jugando en Visitante :D */
      shootsAway--;

    shoots.add(shootsAway);
  }