Example #1
0
  private void getSomeInfo() {

    try {

      List<PlayerDetails> playerList;
      List<TeamDetails> teamList;
      List<LeagueDetails> leagueList;

      System.out.println("List all players in team T2:");
      playerList = request.getPlayersOfTeam("T2");
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List all teams in league L1:");
      teamList = request.getTeamsOfLeague("L1");
      printDetailsList(teamList);
      System.out.println();

      System.out.println("List all defenders:");
      playerList = request.getPlayersByPosition("defender");
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List the leagues of player P28");
      leagueList = request.getLeaguesOfPlayer("P28");
      printDetailsList(leagueList);
      System.out.println();

    } catch (Exception ex) {
      System.err.println("Caught an exception:");
    }
  } // getSomeInfo
Example #2
0
  private void getMoreInfo() {

    try {

      LeagueDetails leagueDetails;
      TeamDetails teamDetails;
      PlayerDetails playerDetails;
      List<PlayerDetails> playerList;
      List<TeamDetails> teamList;
      List<LeagueDetails> leagueList;
      List<String> sportList;

      System.out.println("Details of league L1:");
      leagueDetails = request.getLeague("L1");
      System.out.println(leagueDetails.toString());
      System.out.println();

      System.out.println("Details of team T3:");
      teamDetails = request.getTeam("T3");
      System.out.println(teamDetails.toString());
      System.out.println();

      System.out.println("Details of player P20:");
      playerDetails = request.getPlayer("P20");
      System.out.println(playerDetails.toString());
      System.out.println();

      System.out.println("List all teams in league L3:");
      teamList = request.getTeamsOfLeague("L3");
      printDetailsList(teamList);
      System.out.println();

      System.out.println("List all players:");
      playerList = request.getAllPlayers();
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List all players not on a team:");
      playerList = request.getPlayersNotOnTeam();
      printDetailsList(playerList);
      System.out.println();

      System.out.println("Details of Jack Patterson, a power forward:");
      playerList = request.getPlayersByPositionAndName("power forward", "Jack Patterson");
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List all players in the city of Truckee:");
      playerList = request.getPlayersByCity("Truckee");
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List all soccer players:");
      playerList = request.getPlayersBySport("Soccer");
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List all players in league L1:");
      playerList = request.getPlayersByLeagueId("L1");
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List all players making a higher salary than Ian Carlyle:");
      playerList = request.getPlayersByHigherSalary("Ian Carlyle");
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List all players with a salary between 500 and 800:");
      playerList = request.getPlayersBySalaryRange(500.00, 800.00);
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List all players of team T5:");
      playerList = request.getPlayersOfTeam("T5");
      printDetailsList(playerList);
      System.out.println();

      System.out.println("List all the leagues of player P28:");
      leagueList = request.getLeaguesOfPlayer("P28");
      printDetailsList(leagueList);
      System.out.println();

      System.out.println("List all the sports of player P28:");
      sportList = request.getSportsOfPlayer("P28");
      printDetailsList(sportList);
      System.out.println();

    } catch (Exception ex) {
      System.err.println("Caught an exception:");
    }
  } // getMoreInfo