001: /*
002: This file is part of the PolePosition database benchmark
003: http://www.polepos.org
004:
005: This program is free software; you can redistribute it and/or
006: modify it under the terms of the GNU General Public License
007: as published by the Free Software Foundation; either version 2
008: of the License, or (at your option) any later version.
009:
010: This program is distributed in the hope that it will be useful,
011: but WITHOUT ANY WARRANTY; without even the implied warranty of
012: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013: GNU General Public License for more details.
014:
015: You should have received a copy of the GNU General Public
016: License along with this program; if not, write to the Free
017: Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
018: MA 02111-1307, USA. */
019:
020: package org.polepos;
021:
022: import java.io.*;
023: import java.util.*;
024:
025: import org.polepos.circuits.bahrain.*;
026: import org.polepos.circuits.barcelona.*;
027: import org.polepos.circuits.imola.*;
028: import org.polepos.circuits.melbourne.*;
029: import org.polepos.circuits.sepang.*;
030: import org.polepos.framework.*;
031: import org.polepos.reporters.*;
032: import org.polepos.teams.db4o.*;
033: import org.polepos.teams.hibernate.*;
034: import org.polepos.teams.jdbc.*;
035: import org.polepos.teams.jdo.*;
036: import org.polepos.teams.prevayler.*;
037:
038: /**
039: * @author Herkules
040: *
041: * This is the Main class to run PolePosition.
042: * If JDO is to be tested also, JdoEnhance has to be run first.
043: */
044: public class RunSeason {
045:
046: public static final String PROPERTIES = "settings/Circuits.properties";
047: // public static final String PROPERTIES = "settings/DebugCircuits.properties";
048:
049: private static final Team[] TEAMS = new Team[] { new Db4oTeam(),
050: new HibernateTeam(), new JdbcTeam(), new JdoTeam(),
051: // new PrevaylerTeam(),
052: };
053:
054: static final Circuit[] CIRCUITS = new Circuit[] { new Melbourne(),
055: new Sepang(), new Bahrain(), new Imola(), new Barcelona(), };
056:
057: /**
058: * default: all Teams with all Circuits
059: * @param circuit names and team names
060: */
061: public static void main(String[] args) {
062: List<Circuit> circuits = new ArrayList<Circuit>();
063: List<Team> teams = new ArrayList<Team>();
064: if (args == null || args.length == 0) {
065: addDefault(circuits, teams);
066: } else {
067: for (String arg : args) {
068: String argLowerCase = arg.toLowerCase();
069: for (Team team : TEAMS) {
070: if (team.name().toLowerCase().equals(argLowerCase)) {
071: teams.add(team);
072: }
073: }
074: for (Circuit circuit : CIRCUITS) {
075: if (circuit.name().toLowerCase().equals(
076: argLowerCase)) {
077: circuits.add(circuit);
078: }
079: }
080: }
081: }
082: new Racer(circuits, teams);
083: }
084:
085: private static void addDefault(List<Circuit> circuits,
086: List<Team> teams) {
087: addDefaultCircuits(circuits);
088: addDefaultTeams(teams);
089: }
090:
091: private static void addDefaultTeams(List<Team> teams) {
092: for (Team team : TEAMS) {
093: teams.add(team);
094: }
095: }
096:
097: private static void addDefaultCircuits(List<Circuit> circuits) {
098: for (Circuit circuit : CIRCUITS) {
099: circuits.add(circuit);
100: }
101: }
102:
103: }
|