KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > polepos > RunSeason


1 /*
2 This file is part of the PolePosition database benchmark
3 http://www.polepos.org
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with this program; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 MA 02111-1307, USA. */

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 /**
41  * @author Herkules
42  *
43  * This is the Main class to run PolePosition.
44  * If JDO is to be tested also, JdoEnhance has to be run first.
45  */

46 public class RunSeason {
47     
48     
49     public static final String JavaDoc PROPERTIES = "settings/Circuits.properties";
50     // public static final String PROPERTIES = "settings/DebugCircuits.properties";
51

52     private static final Team[] TEAMS = new Team[]{
53         new Db4oTeam(),
54         new HibernateTeam(),
55         new JdbcTeam(),
56         new JdoTeam(),
57         // new PrevaylerTeam(),
58
};
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     /**
70      * default: all Teams with all Circuits
71      * @param circuit names and team names
72      */

73     public static void main( String JavaDoc[] 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 JavaDoc arg: args){
80                 String JavaDoc 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