package seng302;


import javafx.application.Application;
import javafx.stage.Stage;
import org.xml.sax.SAXException;
import seng302.DataInput.*;
import seng302.Exceptions.InvalidPolarFileException;
import seng302.Model.Event;
import seng302.Model.Polars;


import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;

public class App extends Application {

    /**
     * Entry point for running the programme
     *
     * @param args for starting the programme
     */
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        try {
            Polars boatPolars = PolarParser.parse("polars/acc_polars.csv");
            RaceDataSource raceData = new RaceXMLReader("raceXML/bermuda_AC35.xml", boatPolars);
            RegattaDataSource regattaData = new RegattaXMLReader("mockXML/regattaTest.xml");
            Event raceEvent = new Event(raceData, regattaData);
            raceEvent.start();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (SAXException e) {
            e.printStackTrace();
        } catch (ParserConfigurationException e) {
            e.printStackTrace();
        } catch (InvalidPolarFileException e) {
            e.printStackTrace();
        }
    }
}
