Package common.event

Source Code of common.event.TeamChampionship

/**
*
*/
package common.event;

import java.util.ArrayList;
import java.util.Properties;

import common.Match;
import common.Team;

/**
* @author maximillianeo
*
*/
public class TeamChampionship extends Event{

  private Team homeTeam = null;
  private Team guestTeam = null ;
 
  private final static String EventName = "Team championship";
  /**
   *
   */
  public TeamChampionship(Properties properties) {
    super(TeamChampionship.EventName, CompetType.valueOf("TEAM_CHAMPIONSHIP"), properties);
    super.matches = new ArrayList<Match>(20);
    super.startEvent();
  }

  @Override
  public boolean generateMatches() {
    /*
     * Matches order
     * A-X  1-1
     * D-R  4-4
     * B-Y  2-2
     * E-S  5-5
     * C-Z  3-3
     * F-T  6-6
     * B-X  2-1
     * DOUBLE bottom part DEF-RST 456-456
     * A-Z  1-3
     * E-R  5-4
     * C-Y  3-2
     * D-T  4-6
     * DOUBLE top part ABC-XYZ 123-123
     * F-S  6-5
     * B-Z  2-3
     * E-T  5-6
     * C-X  3-1
     * F-R  6-4
     * A-Y  1-2
     * D-S  4-5
     */
    if( null == homeTeam && null == guestTeam  ){
      return false;
    }
    matches.add(new Match(homeTeam.getPlayer('A').getFirstName(), guestTeam.getPlayer('X').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('D').getFirstName(), guestTeam.getPlayer('R').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('B').getFirstName(), guestTeam.getPlayer('Y').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('E').getFirstName(), guestTeam.getPlayer('S').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('C').getFirstName(), guestTeam.getPlayer('Z').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('F').getFirstName(), guestTeam.getPlayer('T').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('B').getFirstName(), guestTeam.getPlayer('X').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayersNameForBottomDouble(),guestTeam.getPlayersNameForBottomDouble(), (short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('A').getFirstName(), guestTeam.getPlayer('Z').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('E').getFirstName(), guestTeam.getPlayer('R').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('C').getFirstName(), guestTeam.getPlayer('Y').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('D').getFirstName(), guestTeam.getPlayer('T').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayersNameForTopDouble(),guestTeam.getPlayersNameForTopDouble(), (short) (1),false));   
    matches.add(new Match(homeTeam.getPlayer('F').getFirstName(), guestTeam.getPlayer('S').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('B').getFirstName(), guestTeam.getPlayer('Z').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('E').getFirstName(), guestTeam.getPlayer('T').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('C').getFirstName(), guestTeam.getPlayer('X').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('F').getFirstName(), guestTeam.getPlayer('R').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('A').getFirstName(), guestTeam.getPlayer('Y').getFirstName(),(short) (1),false));
    matches.add(new Match(homeTeam.getPlayer('D').getFirstName(), guestTeam.getPlayer('S').getFirstName(),(short) (1),false));
    return true;
  }
 
  /**
   * @return the homeTeam
   */
  public final Team getHomeTeam() {
    return homeTeam;
  }

  /**
   * @param homeTeam the homeTeam to set
   */
  public final void setHomeTeam(Team homeTeam) {
    this.homeTeam = homeTeam;
  }

  /**
   * @return the guestTeam
   */
  public final Team getGuestTeam() {
    return guestTeam;
  }

  /**
   * @param guestTeam the guestTeam to set
   */
  public final void setGuestTeam(Team guestTeam) {
    this.guestTeam = guestTeam;
  }
}
TOP

Related Classes of common.event.TeamChampionship

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.