1 19 20 package org.polepos; 21 22 import java.io.*; 23 import java.util.*; 24 25 import org.polepos.circuits.bahrain.*; 26 import org.polepos.circuits.barcelona.*; 27 import org.polepos.circuits.imola.*; 28 import org.polepos.circuits.melbourne.*; 29 import org.polepos.circuits.sepang.*; 30 import org.polepos.framework.*; 31 import org.polepos.reporters.*; 32 import org.polepos.teams.db4o.*; 33 import org.polepos.teams.hibernate.*; 34 import org.polepos.teams.jdbc.*; 35 import org.polepos.teams.jdo.*; 36 import org.polepos.teams.prevayler.*; 37 38 39 40 46 public class RunSeason { 47 48 49 public static final String PROPERTIES = "settings/Circuits.properties"; 50 52 private static final Team[] TEAMS = new Team[]{ 53 new Db4oTeam(), 54 new HibernateTeam(), 55 new JdbcTeam(), 56 new JdoTeam(), 57 }; 59 60 static final Circuit[] CIRCUITS = new Circuit[]{ 61 new Melbourne(), 62 new Sepang(), 63 new Bahrain(), 64 new Imola(), 65 new Barcelona(), 66 }; 67 68 69 73 public static void main( String [] args ){ 74 List <Circuit> circuits = new ArrayList <Circuit>(); 75 List <Team> teams = new ArrayList <Team>(); 76 if(args == null || args.length == 0){ 77 addDefault(circuits, teams); 78 }else{ 79 for (String arg: args){ 80 String argLowerCase = arg.toLowerCase(); 81 for(Team team : TEAMS){ 82 if(team.name().toLowerCase().equals(argLowerCase)){ 83 teams.add(team); 84 } 85 } 86 for(Circuit circuit: CIRCUITS){ 87 if(circuit.name().toLowerCase().equals(argLowerCase)){ 88 circuits.add(circuit); 89 } 90 } 91 } 92 } 93 new Racer(circuits, teams); 94 } 95 96 private static void addDefault(List <Circuit> circuits, List <Team> teams){ 97 addDefaultCircuits(circuits); 98 addDefaultTeams(teams); 99 } 100 101 private static void addDefaultTeams(List <Team> teams){ 102 for(Team team : TEAMS){ 103 teams.add(team); 104 } 105 } 106 107 private static void addDefaultCircuits(List <Circuit> circuits){ 108 for(Circuit circuit : CIRCUITS){ 109 circuits.add(circuit); 110 } 111 } 112 113 114 } 115 | Popular Tags |