/*
This file is part of the PolePosition database benchmark
http://www.polepos.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
package org.polepos;
import java.io.*;
import java.util.*;
import org.polepos.circuits.bahrain.*;
import org.polepos.circuits.barcelona.*;
import org.polepos.circuits.imola.*;
import org.polepos.circuits.melbourne.*;
import org.polepos.circuits.sepang.*;
import org.polepos.framework.*;
import org.polepos.reporters.*;
import org.polepos.teams.db4o.*;
import org.polepos.teams.hibernate.*;
import org.polepos.teams.jdbc.*;
import org.polepos.teams.jdo.*;
import org.polepos.teams.prevayler.*;
/**
* @author Herkules
*
* This is the Main class to run PolePosition.
* If JDO is to be tested also, JdoEnhance has to be run first.
*/
public class RunSeason {
public static final String PROPERTIES = "settings/Circuits.properties";
// public static final String PROPERTIES = "settings/DebugCircuits.properties";
private static final Team[] TEAMS = new Team[]{
new Db4oTeam(),
new HibernateTeam(),
new JdbcTeam(),
new JdoTeam(),
// new PrevaylerTeam(),
};
static final Circuit[] CIRCUITS = new Circuit[]{
new Melbourne(),
new Sepang(),
new Bahrain(),
new Imola(),
new Barcelona(),
};
/**
* default: all Teams with all Circuits
* @param circuit names and team names
*/
public static void main( String[] args ){
List <Circuit> circuits = new ArrayList <Circuit>();
List <Team> teams = new ArrayList <Team>();
if(args == null || args.length == 0){
addDefault(circuits, teams);
}else{
for (String arg: args){
String argLowerCase = arg.toLowerCase();
for(Team team : TEAMS){
if(team.name().toLowerCase().equals(argLowerCase)){
teams.add(team);
}
}
for(Circuit circuit: CIRCUITS){
if(circuit.name().toLowerCase().equals(argLowerCase)){
circuits.add(circuit);
}
}
}
}
new Racer(circuits, teams);
}
private static void addDefault(List <Circuit> circuits, List <Team> teams){
addDefaultCircuits(circuits);
addDefaultTeams(teams);
}
private static void addDefaultTeams(List <Team> teams){
for(Team team : TEAMS){
teams.add(team);
}
}
private static void addDefaultCircuits(List <Circuit> circuits){
for(Circuit circuit : CIRCUITS){
circuits.add(circuit);
}
}
}
|