// Path: src/main/java/BlueTurtle/gui/GUIController.java
// public class GUIController {
// 
// 
// 	/**
// 	 * Enums to represent the ASATs.
// 	 * 
// 	 * @author BlueTurtle.
// 	 *
// 	 */
// 	public enum ASAT { CheckStyle, PMD, FindBugs; }
// 
// 	@FXML // ResourceBundle that was given to the FXMLLoader
// 	private ResourceBundle resources; //NOPMD - needed for the FXMLLoader.
// 
// 	@FXML // URL location of the FXML file that was given to the FXMLLoader
// 	private URL location; //NOPMD - needed for the FXMLLoader.
// 
// 	@FXML // fx:id="selectButton"
// 	private Button selectButton; // Value injected by FXMLLoader
// 
// 	@FXML // fx:id="projectSourcePathText"
// 	private Text projectSourcePathText; // Value injected by FXMLLoader
// 
// 	@FXML // fx:id="visualizeButton"
// 	private Button visualizeButton; // Value injected by FXMLLoader
// 	
// 	@Getter @Setter private static String projectPath; //NOPMD - warning caused by lombok.
// 	
// 	/**
// 	 * Event for CheckStyle button.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void selectCheckStyleConfigEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Event for PMD button.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void selectPMDConfigEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Event for FindBugs button.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void selectFindBugsConfigEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Events for the LoadButton.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void selectButtonEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Events from the VisualizeButton.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void visualizeButtonEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Initialize the buttons.
// 	 */
// 	@FXML
// 	void initialize() {
// 		assert visualizeButton != null : "fx:id=\"visualizeButton\" was not injected: check your FXML file 'Menu.fxml'.";
// 		assert projectSourcePathText != null : "fx:id=\"projectSourcePathText\" was not injected: check your FXML file 'Menu.fxml'.";
// 		assert selectButton != null : "fx:id=\"selectButton\" was not injected: check your FXML file 'Menu.fxml'.";
// 
// 		// Set the event handlers for the buttons.
// 		selectButton.setOnMouseClicked(new SelectButtonEventHandler(projectSourcePathText, visualizeButton));
// 		visualizeButton.setOnMouseClicked(new VisualizeButtonEventHandler());
// 	}
// 	
// }


import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import BlueTurtle.gui.GUIController;
import BlueTurtle.summarizers.Summarizer;
import BlueTurtle.uav.CodeFile;
import lombok.Getter;
import lombok.Setter;
package BlueTurtle.writers;




/**
 * This class can be used to write the output of the analyzer to JavaScript
 * format.
 * 
 * @author BlueTurtle.
 *
 */
@SuppressWarnings("checkstyle:nowhitespacebefore")
public final class JSWriter {

	private static JSWriter jsWriter = null;

	@Getter @Setter private List<Summarizer> summarizedWarnings;

	/**
	 * Constructor. Only this class can instantiate itself.
	 */
	private JSWriter() {
	}

	/**
	 * Get an instance of this class.
	 * 
	 * @return an instance of this class.
	 */
	public static synchronized JSWriter getInstance() {
		if (jsWriter == null) {
			jsWriter = new JSWriter();
		}
		return jsWriter;
	}

	/**
	 * Write the summarized warnings to a file in JavaScript format.
	 * 
	 * @param outputFilePath
	 *            path to write the output to.
	 * @throws IOException
	 *             throws an exception if something went wrong in the process of
	 *             writing to file.
	 */
	public void writeToJSFormat(String outputFilePath) throws IOException {
		BufferedWriter writer = new BufferedWriter(new FileWriter(outputFilePath));
		Gson gson = new GsonBuilder().setPrettyPrinting().create();
		String json = gson.toJson(summarizedWarnings) + ';';
		writer.write("var inputData = ");
		writer.newLine();
		writer.write(json);
		writer.newLine();
		writer.write("var projectName = " + '"' + GUIController.getProjectPath().substring(
				GUIController.getProjectPath().lastIndexOf(File.separator) + 1,
// Path: src/main/java/BlueTurtle/gui/GUIController.java
// public class GUIController {
// 
// 
// 	/**
// 	 * Enums to represent the ASATs.
// 	 * 
// 	 * @author BlueTurtle.
// 	 *
// 	 */
// 	public enum ASAT { CheckStyle, PMD, FindBugs; }
// 
// 	@FXML // ResourceBundle that was given to the FXMLLoader
// 	private ResourceBundle resources; //NOPMD - needed for the FXMLLoader.
// 
// 	@FXML // URL location of the FXML file that was given to the FXMLLoader
// 	private URL location; //NOPMD - needed for the FXMLLoader.
// 
// 	@FXML // fx:id="selectButton"
// 	private Button selectButton; // Value injected by FXMLLoader
// 
// 	@FXML // fx:id="projectSourcePathText"
// 	private Text projectSourcePathText; // Value injected by FXMLLoader
// 
// 	@FXML // fx:id="visualizeButton"
// 	private Button visualizeButton; // Value injected by FXMLLoader
// 	
// 	@Getter @Setter private static String projectPath; //NOPMD - warning caused by lombok.
// 	
// 	/**
// 	 * Event for CheckStyle button.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void selectCheckStyleConfigEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Event for PMD button.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void selectPMDConfigEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Event for FindBugs button.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void selectFindBugsConfigEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Events for the LoadButton.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void selectButtonEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Events from the VisualizeButton.
// 	 * 
// 	 * @param event
// 	 *            the event.
// 	 */
// 	@FXML
// 	void visualizeButtonEvent(MouseEvent event) { }
// 
// 	/**
// 	 * Initialize the buttons.
// 	 */
// 	@FXML
// 	void initialize() {
// 		assert visualizeButton != null : "fx:id=\"visualizeButton\" was not injected: check your FXML file 'Menu.fxml'.";
// 		assert projectSourcePathText != null : "fx:id=\"projectSourcePathText\" was not injected: check your FXML file 'Menu.fxml'.";
// 		assert selectButton != null : "fx:id=\"selectButton\" was not injected: check your FXML file 'Menu.fxml'.";
// 
// 		// Set the event handlers for the buttons.
// 		selectButton.setOnMouseClicked(new SelectButtonEventHandler(projectSourcePathText, visualizeButton));
// 		visualizeButton.setOnMouseClicked(new VisualizeButtonEventHandler());
// 	}
// 	
// }


// Path: src/main/java/BlueTurtle/writers/JSWriter.java
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import BlueTurtle.gui.GUIController;
import BlueTurtle.summarizers.Summarizer;
import BlueTurtle.uav.CodeFile;
import lombok.Getter;
import lombok.Setter;

package BlueTurtle.writers;




/**
 * This class can be used to write the output of the analyzer to JavaScript
 * format.
 * 
 * @author BlueTurtle.
 *
 */
@SuppressWarnings("checkstyle:nowhitespacebefore")
public final class JSWriter {

	private static JSWriter jsWriter = null;

	@Getter @Setter private List<Summarizer> summarizedWarnings;

	/**
	 * Constructor. Only this class can instantiate itself.
	 */
	private JSWriter() {
	}

	/**
	 * Get an instance of this class.
	 * 
	 * @return an instance of this class.
	 */
	public static synchronized JSWriter getInstance() {
		if (jsWriter == null) {
			jsWriter = new JSWriter();
		}
		return jsWriter;
	}

	/**
	 * Write the summarized warnings to a file in JavaScript format.
	 * 
	 * @param outputFilePath
	 *            path to write the output to.
	 * @throws IOException
	 *             throws an exception if something went wrong in the process of
	 *             writing to file.
	 */
	public void writeToJSFormat(String outputFilePath) throws IOException {
		BufferedWriter writer = new BufferedWriter(new FileWriter(outputFilePath));
		Gson gson = new GsonBuilder().setPrettyPrinting().create();
		String json = gson.toJson(summarizedWarnings) + ';';
		writer.write("var inputData = ");
		writer.newLine();
		writer.write(json);
		writer.newLine();
		writer.write("var projectName = " + '"' + GUIController.getProjectPath().substring(
				GUIController.getProjectPath().lastIndexOf(File.separator) + 1,
				GUIController.getProjectPath().length()) + '"' + ';') ;