5 * $Id: Tournament.java,v 1.1 2006/01/20 21:32:33 vcss232 Exp $
8 * $Log: Tournament.java,v $
9 * Revision 1.1 2006/01/20 21:32:33 vcss232
12 * Revision 1.3 2005/01/12 13:27:40 vcss232
13 * revised constant comment
15 * Revision 1.2 2005/01/12 13:17:26 vcss232
16 * corrected comments; switched constant from private to public
18 * Revision 1.1 2005/01/11 18:38:26 vcss232
27 * This class provides a simple test program that takes one command line
28 * argument representing the number of teams in a league. If the program
29 * confirms that the number of teams is greater than 2 and less than or
30 * equal to the maximum allowed and also that the number of teams is a
31 * power of 2, then it invokes a TournamentMaker object and generates the
32 * match-ups for the first round in a round-robin style tournament;
33 * otherwise, an error message is printed on standard error and the
36 * @author Hank Etlinger
39 public class Tournament
{
42 * maximum number of teams permitted in a tournament; currently
45 public static final int MAX_TEAMS
= 64;
48 * actual number of teams entered in this tournament
50 private static int numberOfTeams
;
55 * @param args command line arguments
57 * @exception IOException may have propagated back from
60 public static void main(String
[] args
) throws IOException
{
62 numberOfTeams
= Integer
.parseInt( args
[ 0 ] );
63 if ( numberOfTeams
< MAX_TEAMS
&& ( numberOfTeams
== 4 ||
65 numberOfTeams
== 16 ||
66 numberOfTeams
== 32 ||
67 numberOfTeams
== 64 ) ) {
68 TournamentMaker tournament
= new TournamentMaker();
69 tournament
.make( numberOfTeams
);
71 System
.err
.print( "Number of teams must be > 2 and <= " + MAX_TEAMS
);
72 System
.err
.println( " and be a power of 2." );