package controller;

import java.io.File;
import java.util.List;
import javafx.application.Application;
import javafx.stage.Stage;

public class MainController extends Application {
    private UserInterface userInterface;

    public static void main(String[] args) throws Exception {

	Parser.parserXml("gridInput.xml");

	launch(args);
    }

    @Override
    public void start(Stage s) throws Exception {
	// create our UI
	userInterface = new UserInterface(s, this);
    }

    public void initializeSimulationWithData(File XMLData) {
	try {
	    List<TestCell> cellList = Parser.parserXml(XMLData
		    .getAbsolutePath());

	} catch (Exception e) {
	    System.out.println("Error processing file, make sure it's XML.");
	}
    }

    public void startSimulation() {
	// TODO Auto-generated method stub

    }

    public void stopSimulation() {
	// TODO Auto-generated method stub

    }

    public void stepSimulation() {
	// TODO Auto-generated method stub

    }

}

@@ -546,16 +546,55 @@
  %7B%0A%09    
+@SuppressWarnings(%22unchecked%22)%0A        
 List%3CTes
@@ -663,16 +663,59 @@
 ath());%0A
+%09    initializeSimulationObjects(cellList);
 %0A%09%7D catc
@@ -807,24 +807,1150 @@
 %22);%0A%09%7D%0A    %7D
+%0A    %0A    private void initializeSimulationObjects(List%3CTestCell%3E cellList)%7B%0A        for (TestCell c : cellList)%7B%0A            try %7B%0A                //create a patch object at the x and y location%0A                %0A                //create a cell object%0A                String classPathAndName = %22simulationObjects.%22+c.cellType;%0A                Class%3C?%3E cellClass = Class.forName(classPathAndName);%0A                System.out.println(cellClass);%0A                Object cell = cellClass.newInstance();%0A                //assign the cell to the patch%0A                //add the patch to grid manager%0A                %0A            %7D%0A            catch (ClassNotFoundException e) %7B%0A                System.out.println(%22One or more cell classes from your XML file could not be found.%22);%0A            %7D%0A            catch (InstantiationException e) %7B%0A                System.out.println(%22One or more paramaters could not be applied to the simulation.%22);%0A            %7D%0A            catch (IllegalAccessException e) %7B%0A                System.out.println(%22Couldn't create a class from the XML file: illegal access.%22);%0A            %7D%0A        %7D%0A    %7D
 %0A%0A    public

Use the parser and initialize cell classes using reflection.