Skip to content
Snippets Groups Projects
StreamMain.java 1.53 KiB
Newer Older
Jan Kožusznik's avatar
Jan Kožusznik committed
package cz.jezek.lab11;

public class StreamMain {

  public static void main(String[] args) {
    Tournament tournament = Tournament.generate();

    printStatAboutTournament(tournament);

    saveTournament(tournament);
    loadTournament();
  }

  public static void printStatAboutTournament(Tournament tournament) {
    System.out.println(tournament);
    Player player = tournament.getRandomPlayer();

    System.out.println(player);
Jan Kožusznik's avatar
Jan Kožusznik committed
    System.out.print("Number of matches: ");
    //TODO 3.a Show the number of matches played by a given player (using Streams)
    
    System.out.print("Goals scored: ");
    //TODO 3.b Show the number of goals scored by a given player (help Streams)
Jan Kožusznik's avatar
Jan Kožusznik committed

    Oponents oponents = new Oponents(tournament.getRandomPlayer(),
        tournament.getRandomPlayer());
Jan Kožusznik's avatar
Jan Kožusznik committed
    System.out.println("Mutual statistics of oponents:" + oponents);
    
    System.out.print("Matches: ");
    //TODO 4.a List the matches played between the given players (using the stream)
    System.out.print("Number of mathes: ");
    //TODO 4.b Print the number of matches played between the given players (using the stream)
    System.out.print("Match with the largest total number:");
Jan Kožusznik's avatar
Jan Kožusznik committed
    //TODO 4.c Show match with the largest total number (sum of both players) scored goals between relevant players (help Streams)
Jan Kožusznik's avatar
Jan Kožusznik committed
  }

  public static void loadTournament() {
Jan Kožusznik's avatar
Jan Kožusznik committed
    //TODO 5.b Load a serialized tournament from a file
Jan Kožusznik's avatar
Jan Kožusznik committed
  }

  public static void saveTournament(Tournament tournament) {
Jan Kožusznik's avatar
Jan Kožusznik committed
    //TODO 5.a Save the tournament to a file using object serialization.
Jan Kožusznik's avatar
Jan Kožusznik committed
  }
}